问:
i can't unpack drqa on git
i can't unpack drqa on git

```<code>Collecting https://github.com/facebookresearch/DrQA.git
  Downloading https://github.com/facebookresearch/DrQA.git
     / 267.0 kB 1.0 MB/s 0:00:00
  ERROR: Cannot unpack file C:\Users\ADMIN\AppData\Local\Temp\pip-unpack-f764kpoq\DrQA.git (downloaded from C:\Users\ADMIN\AppData\Local\Temp\pip-req-build-7__5_3mj, content-type: text/html; charset=utf-8); cannot detect archive format
ERROR: Cannot determine archive format of C:\Users\ADMIN\AppData\Local\Temp\pip-req-build-7__5_3mj
</code>```

i used pip install but doesn't work

Title: i can't unpack drqa on git

Body:
i can't unpack drqa on git

Collecting https://github.com/facebookresearch/DrQA.git
  Downloading https://github.com/facebookresearch/DrQA.git
     / 267.0 kB 1.0 MB/s 0:00:00
  ERROR: Cannot unpack file C:\Users\ADMIN\AppData\Local\Temp\pip-unpack-f764kpoq\DrQA.git (downloaded from C:\Users\ADMIN\AppData\Local\Temp\pip-req-build-7__5_3mj, content-type: text/html; charset=utf-8); cannot detect archive format
ERROR: Cannot determine archive format of C:\Users\ADMIN\AppData\Local\Temp\pip-req-build-7__5_3mj

i used pip install but doesn't work


来源: stackexchange

问:
Is there an option to see changed lines/files even if changes were committed?
After commit all the changes I'm unable to see which files and lines were changed. I'd like to see them and know that I changed them even if they were committed.

Is there an option to see changes after commit?

ContentLicense: CC BY-SA 4.0


问:
Create XML variable in SQL Server and append values to it
Is there a way to create XML type variable in Microsoft SQL Server and append values to it using a cursor? It should work like this:

Create empty XML type variable

Open cursor

Create dynamic SQL query in cursor depending on cursor value that generates result which is XML

In each fetch append result of query to XML variable

Is this even possible?

Problem is, I am generating XML, but the query to get it is dynamic and each query gets results from another table which I get using cursor and

```<code>select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
</code>```

For each table_name I get from this cursor, there is another query which generates XML result, which should all be merged into one XML.

This is done by making query as string variable which is executed later and should append to the XML variable.

This would be sample how one of such dynamic queries could look like where later TABLENAME should be replaced with table_name from cursor and then execute query:

```<code>select
    _TABLENAME_ as 'TABLE/@path',
    (select
         t1.id as 'value/@id',
         t1.name as 'value',
         t2.name as 'value_jp'
     from
         _TABLE_NAME t1, _TABLENAME_ + '_locale' t2
     where
         t1.ID = t2.FK_Id and t2.FK_Locale = 38
     for xml path(''), root('rows'), type)
for xml path('')
</code>```

Body:
Is there a way to create XML type variable in Microsoft SQL Server and append values to it using a cursor? It should work like this:

Create empty XML type variable

Open cursor

Create dynamic SQL query in cursor depending on cursor value that generates result which is XML

In each fetch append result of query to XML variable

Is this even possible?

Problem is, I am generating XML, but the query to get it is dynamic and each query gets results from another table which I get using cursor and

select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES

For each table_name I get from this cursor, there is another query which generates XML result, which should all be merged into one XML.

This is done by making query as string variable which is executed later and should append to the XML variable.

This would be sample how one of such dynamic queries could look like where later TABLENAME should be replaced with table_name from cursor and then execute query:

select
    _TABLENAME_ as 'TABLE/@path',
    (select
         t1.id as 'value/@id',
         t1.name as 'value',
         t2.name as 'value_jp'
     from
         _TABLE_NAME t1, _TABLENAME_ + '_locale' t2
     where
         t1.ID = t2.FK_Id and t2.FK_Locale = 38
     for xml path(''), root('rows'), type)
for xml path('')


问:
Changing window.location.reload Time
Running

`

```<code>setTimeout(function(){
    window.location.reload(1);
}, 30000);
</code>```

`

This gives me a refresh every 30 seconds. I want to change or pause it while user is typing into a text box.
Thinking a oninput event. How can I change the 30000?

Title: Changing window.location.reload Time

Body:
Running

`

setTimeout(function(){
    window.location.reload(1);
}, 30000);

`

This gives me a refresh every 30 seconds. I want to change or pause it while user is typing into a text box.
Thinking a oninput event. How can I change the 30000?


问:
onIceCandidate method never called
I am working with WebRTC on jetpack compose using socket io, an offer comes to me from the server for a video call with the user and I save it as remoteDescription, then I create my answer for this offer, save it as localDescription and send the answer to the user, I do everything done from the operator side. The user, in turn, before sending the offer, saves it as localDescription, and my answer as RemoteDescription. And logically, after the user and I have saved the localDescription, we should exchange iceCandidae. But instead, my own iceCandidate is not created and the onIceCandidate method is not called, but everything works fine for the user. If anyone knows the reason please help me!

my RTCClient class:

```<code>import org.webrtc.*
import org.webrtc.Logging.Severity
import org.webrtc.PeerConnection.IceServer
import org.webrtc.PeerConnection.Observer
import org.webrtc.SurfaceTextureHelper.create

class RTCClient(
    private val context: Context,
) {

    companion object {
        private val TAG = RTCClient::class.java.simpleName
    }

    val eglContext = EglBase.create()

    private val peerConnectionFactory by lazy(LazyThreadSafetyMode.NONE) {
        createPeerConnectionFactory()
    }

    private var peerConnection: PeerConnection? = null
//    by lazy(LazyThreadSafetyMode.NONE) {
//
//    }

    private val sdpObserver = InnerSdpObserver()

    private var localStream: MediaStream? = null
    private var remoteStream: MediaStream? = null

    private val videoCapturer by lazy(LazyThreadSafetyMode.NONE) {
        Logger.debug(TAG, "getVideoCapturer()")

        Camera2Enumerator(context).run {
            deviceNames.find { isFrontFacing(it) }?.let {
                createCapturer(it, object : CameraVideoCapturer.CameraEventsHandler {
                    override fun onFirstFrameAvailable() {

                    }

                    override fun onCameraOpening(p0: String?) {

                    }

                    override fun onCameraFreezed(p0: String?) {

                    }

                    override fun onCameraError(p0: String?) {

                    }

                    override fun onCameraDisconnected() {

                    }

                    override fun onCameraClosed() {

                    }
                })
            } ?: throw IllegalStateException()
        }
    }

    private val localAudioSource by lazy(LazyThreadSafetyMode.NONE) {
        peerConnectionFactory.createAudioSource(MediaConstraints().apply {
            mandatory.add(MediaConstraints.KeyValuePair("googEchoCancellation", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googEchoCancellation2", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googAutoGainControl", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googAutoGainControl2", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googNoiseSuppression", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googNoiseSuppression2", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googHighpassFilter", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googAudioMirroring", "false"))
        })
    }

    private val localVideoSource by lazy(LazyThreadSafetyMode.NONE) {
        peerConnectionFactory.createVideoSource(false)
    }

    private var surfaceViewCallback: SurfaceViewCallback? = null

    private var localSessionDescription: SessionDescription? = null
    private var remoteSessionDescription: SessionDescription? = null

    var currentSubscriber: String? = null

    private val observer = object : Observer {
        override fun onSignalingChange(p0: PeerConnection.SignalingState?) {
            Logger.debug(TAG, "Observer#onSignalingChange() -> $p0")
        }

        override fun onIceConnectionChange(p0: PeerConnection.IceConnectionState?) {
            Logger.debug(TAG, "Observer#onIceConnectionChange() -> $p0")
        }

        override fun onStandardizedIceConnectionChange(newState: PeerConnection.IceConnectionState?) {
            Logger.debug(TAG, "Observer#onStandardizedIceConnectionChange() -> $newState")
        }

        override fun onConnectionChange(newState: PeerConnection.PeerConnectionState?) {
            Logger.debug(TAG, "Observer#onConnectionChange() -> $newState")
        }

        override fun onIceConnectionReceivingChange(p0: Boolean) {
            Logger.debug(TAG, "Observer#onIceConnectionReceivingChange() -> $p0")
        }

        override fun onIceGatheringChange(p0: PeerConnection.IceGatheringState?) {
            Logger.debug(TAG, "Observer#onIceGatheringChange() -> $p0")
        }

        override fun onIceCandidate(p0: IceCandidate?) {
            Logger.debug(TAG, "Observer#onIceCandidate -> $p0")

//            addIceCandidate(p0)

            socketClient.sendRtcMessage(
                candidate = p0?.sdp,
                type = "candidate",
                user = currentSubscriber,
                label = p0?.sdpMLineIndex,
                id = p0?.sdpMid
            )
        }

        override fun onIceCandidatesRemoved(p0: Array<out IceCandidate>?) {
            Logger.debug(TAG, "Observer#onIceCandidatesRemoved() -> $p0")
        }

        override fun onSelectedCandidatePairChanged(event: CandidatePairChangeEvent?) {
            Logger.debug(TAG, "Observer#onSelectedCandidatePairChanged() -> $event")
        }

        override fun onAddStream(p0: MediaStream?) {
            Logger.debug(TAG, "Observer#onAddStream() -> $p0")

            surfaceViewCallback?.onAddRemoteStream(p0)
        }

        override fun onRemoveStream(p0: MediaStream?) {
            Logger.debug(TAG, "Observer#onRemoveStream() -> $p0")

//            surfaceViewCallback?.onRemoveRemoteStream(p0)
        }

        override fun onDataChannel(p0: DataChannel?) {
            Logger.debug(TAG, "Observer#onDataChannel() -> $p0")
        }

        override fun onRenegotiationNeeded() {
            Logger.debug(TAG, "Observer#onRenegotiationNeeded()")
        }

        override fun onRemoveTrack(receiver: RtpReceiver?) {
            Logger.debug(TAG, "Observer#onRemoveTrack() -> $receiver")

//            if (receiver?.track()?.kind() == "video") {
//                surfaceViewCallback?.onRemoveRemoteStream(null)
//            }
        }

        override fun onTrack(transceiver: RtpTransceiver?) {
            Logger.debug(
                TAG,
                "Observer#onTrack() -> ${transceiver?.currentDirection}, ${transceiver?.mid}"
            )
        }
    }

    init {
        initPeerConnectionFactory()
    }

    private fun initPeerConnectionFactory() {
        Logger.debug(TAG, "initPeerConnectionFactory()")

        PeerConnectionFactory.initialize(
            PeerConnectionFactory.InitializationOptions.builder(context)
                .setEnableInternalTracer(true)
                .setInjectableLogger({ p0, p1, p2 ->
                    Logger.debug(TAG, "Internal: $p0 $p1 $p2")
                }, Severity.LS_WARNING)
                .createInitializationOptions()
        )
        peerConnection = createPeerConnection()
    }

    private fun createPeerConnectionFactory(): PeerConnectionFactory {
        Logger.debug(TAG, "createPeerConnectionFactory()")

        return PeerConnectionFactory.builder()
            .setVideoEncoderFactory(
                DefaultVideoEncoderFactory(
                    eglContext.eglBaseContext,
                    true,
                    true
                )
            )
            .setVideoDecoderFactory(
                DefaultVideoDecoderFactory(eglContext.eglBaseContext)
            )
//            .setVideoEncoderFactory(
//                SoftwareVideoEncoderFactory()
//            )
//            .setVideoDecoderFactory(
//                SoftwareVideoDecoderFactory()
//            )
            .setOptions(
                PeerConnectionFactory.Options().apply {
                    disableEncryption = true
                    disableNetworkMonitor = true
                }
            )
            .createPeerConnectionFactory()
    }

    private fun createPeerConnection(): PeerConnection? {
        Logger.debug(TAG, "createPeerConnection()")

        return peerConnectionFactory.createPeerConnection(
            PeerConnection.RTCConfiguration(iceServers).apply {
                iceTransportsType = PeerConnection.IceTransportsType.ALL
                bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE
                rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE
                tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.DISABLED
                continualGatheringPolicy =
                    PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY
            },
            observer
        )
    }

    fun initSurfaceViewCallback(callback: SurfaceViewCallback) {
        Logger.debug(TAG, "initSurfaceViewCallback() -> $callback")

        surfaceViewCallback = callback
    }

    fun startLocalVideo(): MediaStream? {
        Logger.debug(TAG, "startLocalVideo()")

        val surfaceTextureHelper = create("CaptureThread", eglContext.eglBaseContext)
        videoCapturer.initialize(
            surfaceTextureHelper,
            context,
            localVideoSource.capturerObserver
        )
        videoCapturer.startCapture(1280, 720, 30)

        localStream = peerConnectionFactory.createLocalMediaStream("ARDAMS")

        val localAudioTrack =
            peerConnectionFactory.createAudioTrack("audio_track", localAudioSource)
        localStream?.addTrack(localAudioTrack)

        val localVideoTrack =
            peerConnectionFactory.createVideoTrack("local_track", localVideoSource)
        localStream?.addTrack(localVideoTrack)

        peerConnection?.addStream(localStream)
        return localStream
    }

    fun onRemoteSessionDescriptionReceived(sessionDescription: SessionDescription) {
        Logger.debug(TAG, "onRemoteSessionDescriptionReceived() -> ${sessionDescription.type}")

        var description = CodecUtils.preferCodec(
            sessionDescription.description,
            CodecUtils.AUDIO_CODEC_OPUS,
            true
        )

        description = CodecUtils.preferCodec(
            description,
            CodecUtils.VIDEO_CODEC_VP9,
            false
        )
        remoteSessionDescription = SessionDescription(sessionDescription.type, description)
        peerConnection?.setRemoteDescription(
            sdpObserver,
            remoteSessionDescription
        )
    }

    private inner class InnerSdpObserver : SdpObserver {
        override fun onCreateSuccess(sessionDescription: SessionDescription?) {
            Logger.debug(TAG, "InnerSdpObserver#onCreateSuccess() -> $sessionDescription")

            var description = CodecUtils.preferCodec(
                sessionDescription?.description,
                CodecUtils.AUDIO_CODEC_OPUS,
                true
            )

            description = CodecUtils.preferCodec(
                description,
                CodecUtils.VIDEO_CODEC_VP9,
                false
            )

            localSessionDescription = SessionDescription(sessionDescription?.type, description)

            peerConnection?.setLocalDescription(sdpObserver, localSessionDescription)
        }

        override fun onCreateFailure(p0: String?) {
            Logger.debug(TAG, "InnerSdpObserver#onCreateFailure() -> $p0")
        }

        override fun onSetSuccess() {
            Logger.debug(TAG, "InnerSdpObserver#onSetSuccess()")

            localSessionDescription?.let {
                if (it.type == SessionDescription.Type.ANSWER) {
                    Logger.debug(TAG, "onSetSuccess() -> createAnswer: $currentSubscriber")
                    socketClient.sendRtcMessage(
                        sdp = it.description,
                        type = "answer",
                        user = currentSubscriber
                    )
                } else if (it.type == SessionDescription.Type.OFFER) {
                    Logger.debug(TAG, "onSetSuccess() -> createOffer: $currentSubscriber")
                    socketClient.sendRtcMessage(
                        sdp = it.description,
                        type = "offer",
                        user = currentSubscriber
                    )
                }
            }
        }

        override fun onSetFailure(p0: String?) {
            Logger.debug(TAG, "InnerSdpObserver#onSetFailure() -> $p0")
        }
    }

    fun sendOffer() {
        Logger.debug(TAG, "sendOffer()")

        peerConnection?.createOffer(sdpObserver, MediaConstraints().apply {
            mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"))
        })
    }

    fun sendAnswer() {
        Logger.debug(TAG, "sendAnswer()")

        peerConnection?.createAnswer(sdpObserver, MediaConstraints().apply {
            mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"))
        })
    }

    fun addIceCandidate(iceCandidate: IceCandidate) {
        Logger.debug(TAG, "addIceCandidate() -> $iceCandidate")

        peerConnection?.addIceCandidate(iceCandidate, object : AddIceObserver {
            override fun onAddSuccess() {
                Logger.debug(TAG, "AddIceObserver#onAddSuccess()")
            }

            override fun onAddFailure(p0: String?) {
                Logger.debug(TAG, "AddIceObserver#onAddFailure() -> $p0")
            }
        })
    }

    fun finishPeerConnection() {
        Logger.debug(TAG, "finishPeerConnection()")

        videoCapturer.stopCapture()

        localStream?.let {
            peerConnection?.removeStream(it)
        }

        peerConnection?.dispose()
    }
}

interface SurfaceViewCallback {
    fun onAddRemoteStream(mediaStream: MediaStream?)
    fun onRemoveRemoteStream(mediaStream: MediaStream?)
}

</code>```

this is my messageListener:

```<code>} else if (jsonObject.has("rtc")) {
    val idChat = jsonObject.getStringOrNull("chat")
    val sender = jsonObject.getStringOrNull("sender")
    val rtcObject = jsonObject.getJSONObject("rtc")
    val rtcModel = WebRTCModel.RTCModel(
        type = rtcObject.getStringOrNull("type"),
        sdp = rtcObject.getStringOrNull("sdp"),
        from = rtcObject.getStringOrNull("_from"),
        candidate = rtcObject.getStringOrNull("candidate"),
        id = rtcObject.getStringOrNull("id"),
        label = rtcObject.getIntOrNull("label")
    )
    if (rtcObject.getStringOrNull("type").equals("hangup")) {
        callEndCallback?.callEnd(
            webRTCModel = WebRTCModel(
                chatId = idChat,
                sender = sender,
                rtc = rtcModel
            )
        )
        callPageCallback?.callEnd()
    } else {
        callPageCallback?.onMessage(
            webRTCModel = WebRTCModel(
                chatId = idChat,
                sender = sender,
                rtc = rtcModel
            )
        )
    }
}
</code>```

One more thing iceConnectionChange callback changes to CHECKING after it accepts the user's iceCandidate.
And one more thing, the logs that appeared after receiving the offer may be useful:

```<code>D/RTCClient: onRemoteSessionDescriptionReceived() -> OFFER
D/RTCClient: Observer#onSignalingChange() -> HAVE_REMOTE_OFFER
D/RTCClient: Internal: (line 329): Elapsed time (163576 ms) longer than expected, limiting to 2000
     LS_WARNING pacing_controller.cc
D/RTCClient: Internal: (line 3446): Absent receive stream; ignoring clearing encoded frame sink for ssrc 0
     LS_ERROR webrtc_video_engine.cc
D/RTCClient: Observer#onAddStream() -> [gre6aHoVs2GaW0CM9m1Ava8gBe0ss2VhPbLY:A=1:V=1]
D/VideoCallComponent: onAddRemoteStream() -> [gre6aHoVs2GaW0CM9m1Ava8gBe0ss2VhPbLY:A=1:V=1]
D/RTCClient: InnerSdpObserver#onSetSuccess()
D/RTCClient: sendAnswer()
D/RTCClient: Internal: (line 936): RED codec red is missing an associated payload type.
     LS_WARNING media_session.cc
D/VideoCallComponent: VideoCall.Model#subscribe() -> Model(localStream=[ARDAMS:A=1:V=1], remoteStream=[gre6aHoVs2GaW0CM9m1Ava8gBe0ss2VhPbLY:A=1:V=1])
D/RTCClient: InnerSdpObserver#onCreateSuccess() -> org.webrtc.SessionDescription@cc58193
D/VideoScreen: model.subscribeAsState() -> Model(localStream=[ARDAMS:A=1:V=1], remoteStream=[gre6aHoVs2GaW0CM9m1Ava8gBe0ss2VhPbLY:A=1:V=1])
E/xoffice.androi: No package ID ff found for ID 0xffffffff.
D/RTCClient: Observer#onSignalingChange() -> STABLE
D/RTCClient: Observer#onRemoveTrack() -> org.webrtc.RtpReceiver@47e13a6
I/SurfaceView: onWindowVisibilityChanged(0) true org.webrtc.SurfaceViewRenderer{c0f21e7 V.E...... ......I. 0,0-0,0} of ViewRootImpl@643f65f[MainActivity]
D/RTCClient: Observer#onRemoveTrack() -> org.webrtc.RtpReceiver@2a3f43d
D/RTCClient: InnerSdpObserver#onSetSuccess()
D/RTCClient: onSetSuccess() -> createAnswer: user:ws:d8DHOnpJHYb6FC0VACHr

</code>```

and after saving the answer in setLocalDescription:

D/RTCClient: Observer#onIceConnectionChange() -> CHECKING

The output of iceCandidates in the onIceCandidate method

Title: onIceCandidate method never called

Body:
I am working with WebRTC on jetpack compose using socket io, an offer comes to me from the server for a video call with the user and I save it as remoteDescription, then I create my answer for this offer, save it as localDescription and send the answer to the user, I do everything done from the operator side. The user, in turn, before sending the offer, saves it as localDescription, and my answer as RemoteDescription. And logically, after the user and I have saved the localDescription, we should exchange iceCandidae. But instead, my own iceCandidate is not created and the onIceCandidate method is not called, but everything works fine for the user. If anyone knows the reason please help me!

my RTCClient class:

import org.webrtc.*
import org.webrtc.Logging.Severity
import org.webrtc.PeerConnection.IceServer
import org.webrtc.PeerConnection.Observer
import org.webrtc.SurfaceTextureHelper.create

class RTCClient(
    private val context: Context,
) {

    companion object {
        private val TAG = RTCClient::class.java.simpleName
    }

    val eglContext = EglBase.create()

    private val peerConnectionFactory by lazy(LazyThreadSafetyMode.NONE) {
        createPeerConnectionFactory()
    }

    private var peerConnection: PeerConnection? = null
//    by lazy(LazyThreadSafetyMode.NONE) {
//
//    }

    private val sdpObserver = InnerSdpObserver()

    private var localStream: MediaStream? = null
    private var remoteStream: MediaStream? = null

    private val videoCapturer by lazy(LazyThreadSafetyMode.NONE) {
        Logger.debug(TAG, "getVideoCapturer()")

        Camera2Enumerator(context).run {
            deviceNames.find { isFrontFacing(it) }?.let {
                createCapturer(it, object : CameraVideoCapturer.CameraEventsHandler {
                    override fun onFirstFrameAvailable() {

                    }

                    override fun onCameraOpening(p0: String?) {

                    }

                    override fun onCameraFreezed(p0: String?) {

                    }

                    override fun onCameraError(p0: String?) {

                    }

                    override fun onCameraDisconnected() {

                    }

                    override fun onCameraClosed() {

                    }
                })
            } ?: throw IllegalStateException()
        }
    }

    private val localAudioSource by lazy(LazyThreadSafetyMode.NONE) {
        peerConnectionFactory.createAudioSource(MediaConstraints().apply {
            mandatory.add(MediaConstraints.KeyValuePair("googEchoCancellation", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googEchoCancellation2", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googAutoGainControl", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googAutoGainControl2", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googNoiseSuppression", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googNoiseSuppression2", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googHighpassFilter", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("googAudioMirroring", "false"))
        })
    }

    private val localVideoSource by lazy(LazyThreadSafetyMode.NONE) {
        peerConnectionFactory.createVideoSource(false)
    }

    private var surfaceViewCallback: SurfaceViewCallback? = null

    private var localSessionDescription: SessionDescription? = null
    private var remoteSessionDescription: SessionDescription? = null

    var currentSubscriber: String? = null

    private val observer = object : Observer {
        override fun onSignalingChange(p0: PeerConnection.SignalingState?) {
            Logger.debug(TAG, "Observer#onSignalingChange() -> $p0")
        }

        override fun onIceConnectionChange(p0: PeerConnection.IceConnectionState?) {
            Logger.debug(TAG, "Observer#onIceConnectionChange() -> $p0")
        }

        override fun onStandardizedIceConnectionChange(newState: PeerConnection.IceConnectionState?) {
            Logger.debug(TAG, "Observer#onStandardizedIceConnectionChange() -> $newState")
        }

        override fun onConnectionChange(newState: PeerConnection.PeerConnectionState?) {
            Logger.debug(TAG, "Observer#onConnectionChange() -> $newState")
        }

        override fun onIceConnectionReceivingChange(p0: Boolean) {
            Logger.debug(TAG, "Observer#onIceConnectionReceivingChange() -> $p0")
        }

        override fun onIceGatheringChange(p0: PeerConnection.IceGatheringState?) {
            Logger.debug(TAG, "Observer#onIceGatheringChange() -> $p0")
        }

        override fun onIceCandidate(p0: IceCandidate?) {
            Logger.debug(TAG, "Observer#onIceCandidate -> $p0")

//            addIceCandidate(p0)

            socketClient.sendRtcMessage(
                candidate = p0?.sdp,
                type = "candidate",
                user = currentSubscriber,
                label = p0?.sdpMLineIndex,
                id = p0?.sdpMid
            )
        }

        override fun onIceCandidatesRemoved(p0: Array<out IceCandidate>?) {
            Logger.debug(TAG, "Observer#onIceCandidatesRemoved() -> $p0")
        }

        override fun onSelectedCandidatePairChanged(event: CandidatePairChangeEvent?) {
            Logger.debug(TAG, "Observer#onSelectedCandidatePairChanged() -> $event")
        }

        override fun onAddStream(p0: MediaStream?) {
            Logger.debug(TAG, "Observer#onAddStream() -> $p0")

            surfaceViewCallback?.onAddRemoteStream(p0)
        }

        override fun onRemoveStream(p0: MediaStream?) {
            Logger.debug(TAG, "Observer#onRemoveStream() -> $p0")

//            surfaceViewCallback?.onRemoveRemoteStream(p0)
        }

        override fun onDataChannel(p0: DataChannel?) {
            Logger.debug(TAG, "Observer#onDataChannel() -> $p0")
        }

        override fun onRenegotiationNeeded() {
            Logger.debug(TAG, "Observer#onRenegotiationNeeded()")
        }

        override fun onRemoveTrack(receiver: RtpReceiver?) {
            Logger.debug(TAG, "Observer#onRemoveTrack() -> $receiver")

//            if (receiver?.track()?.kind() == "video") {
//                surfaceViewCallback?.onRemoveRemoteStream(null)
//            }
        }

        override fun onTrack(transceiver: RtpTransceiver?) {
            Logger.debug(
                TAG,
                "Observer#onTrack() -> ${transceiver?.currentDirection}, ${transceiver?.mid}"
            )
        }
    }

    init {
        initPeerConnectionFactory()
    }

    private fun initPeerConnectionFactory() {
        Logger.debug(TAG, "initPeerConnectionFactory()")

        PeerConnectionFactory.initialize(
            PeerConnectionFactory.InitializationOptions.builder(context)
                .setEnableInternalTracer(true)
                .setInjectableLogger({ p0, p1, p2 ->
                    Logger.debug(TAG, "Internal: $p0 $p1 $p2")
                }, Severity.LS_WARNING)
                .createInitializationOptions()
        )
        peerConnection = createPeerConnection()
    }

    private fun createPeerConnectionFactory(): PeerConnectionFactory {
        Logger.debug(TAG, "createPeerConnectionFactory()")

        return PeerConnectionFactory.builder()
            .setVideoEncoderFactory(
                DefaultVideoEncoderFactory(
                    eglContext.eglBaseContext,
                    true,
                    true
                )
            )
            .setVideoDecoderFactory(
                DefaultVideoDecoderFactory(eglContext.eglBaseContext)
            )
//            .setVideoEncoderFactory(
//                SoftwareVideoEncoderFactory()
//            )
//            .setVideoDecoderFactory(
//                SoftwareVideoDecoderFactory()
//            )
            .setOptions(
                PeerConnectionFactory.Options().apply {
                    disableEncryption = true
                    disableNetworkMonitor = true
                }
            )
            .createPeerConnectionFactory()
    }

    private fun createPeerConnection(): PeerConnection? {
        Logger.debug(TAG, "createPeerConnection()")

        return peerConnectionFactory.createPeerConnection(
            PeerConnection.RTCConfiguration(iceServers).apply {
                iceTransportsType = PeerConnection.IceTransportsType.ALL
                bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE
                rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE
                tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.DISABLED
                continualGatheringPolicy =
                    PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY
            },
            observer
        )
    }

    fun initSurfaceViewCallback(callback: SurfaceViewCallback) {
        Logger.debug(TAG, "initSurfaceViewCallback() -> $callback")

        surfaceViewCallback = callback
    }

    fun startLocalVideo(): MediaStream? {
        Logger.debug(TAG, "startLocalVideo()")

        val surfaceTextureHelper = create("CaptureThread", eglContext.eglBaseContext)
        videoCapturer.initialize(
            surfaceTextureHelper,
            context,
            localVideoSource.capturerObserver
        )
        videoCapturer.startCapture(1280, 720, 30)

        localStream = peerConnectionFactory.createLocalMediaStream("ARDAMS")

        val localAudioTrack =
            peerConnectionFactory.createAudioTrack("audio_track", localAudioSource)
        localStream?.addTrack(localAudioTrack)

        val localVideoTrack =
            peerConnectionFactory.createVideoTrack("local_track", localVideoSource)
        localStream?.addTrack(localVideoTrack)

        peerConnection?.addStream(localStream)
        return localStream
    }

    fun onRemoteSessionDescriptionReceived(sessionDescription: SessionDescription) {
        Logger.debug(TAG, "onRemoteSessionDescriptionReceived() -> ${sessionDescription.type}")

        var description = CodecUtils.preferCodec(
            sessionDescription.description,
            CodecUtils.AUDIO_CODEC_OPUS,
            true
        )

        description = CodecUtils.preferCodec(
            description,
            CodecUtils.VIDEO_CODEC_VP9,
            false
        )
        remoteSessionDescription = SessionDescription(sessionDescription.type, description)
        peerConnection?.setRemoteDescription(
            sdpObserver,
            remoteSessionDescription
        )
    }

    private inner class InnerSdpObserver : SdpObserver {
        override fun onCreateSuccess(sessionDescription: SessionDescription?) {
            Logger.debug(TAG, "InnerSdpObserver#onCreateSuccess() -> $sessionDescription")

            var description = CodecUtils.preferCodec(
                sessionDescription?.description,
                CodecUtils.AUDIO_CODEC_OPUS,
                true
            )

            description = CodecUtils.preferCodec(
                description,
                CodecUtils.VIDEO_CODEC_VP9,
                false
            )

            localSessionDescription = SessionDescription(sessionDescription?.type, description)

            peerConnection?.setLocalDescription(sdpObserver, localSessionDescription)
        }

        override fun onCreateFailure(p0: String?) {
            Logger.debug(TAG, "InnerSdpObserver#onCreateFailure() -> $p0")
        }

        override fun onSetSuccess() {
            Logger.debug(TAG, "InnerSdpObserver#onSetSuccess()")

            localSessionDescription?.let {
                if (it.type == SessionDescription.Type.ANSWER) {
                    Logger.debug(TAG, "onSetSuccess() -> createAnswer: $currentSubscriber")
                    socketClient.sendRtcMessage(
                        sdp = it.description,
                        type = "answer",
                        user = currentSubscriber
                    )
                } else if (it.type == SessionDescription.Type.OFFER) {
                    Logger.debug(TAG, "onSetSuccess() -> createOffer: $currentSubscriber")
                    socketClient.sendRtcMessage(
                        sdp = it.description,
                        type = "offer",
                        user = currentSubscriber
                    )
                }
            }
        }

        override fun onSetFailure(p0: String?) {
            Logger.debug(TAG, "InnerSdpObserver#onSetFailure() -> $p0")
        }
    }

    fun sendOffer() {
        Logger.debug(TAG, "sendOffer()")

        peerConnection?.createOffer(sdpObserver, MediaConstraints().apply {
            mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"))
        })
    }

    fun sendAnswer() {
        Logger.debug(TAG, "sendAnswer()")

        peerConnection?.createAnswer(sdpObserver, MediaConstraints().apply {
            mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"))
            mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"))
        })
    }

    fun addIceCandidate(iceCandidate: IceCandidate) {
        Logger.debug(TAG, "addIceCandidate() -> $iceCandidate")

        peerConnection?.addIceCandidate(iceCandidate, object : AddIceObserver {
            override fun onAddSuccess() {
                Logger.debug(TAG, "AddIceObserver#onAddSuccess()")
            }

            override fun onAddFailure(p0: String?) {
                Logger.debug(TAG, "AddIceObserver#onAddFailure() -> $p0")
            }
        })
    }

    fun finishPeerConnection() {
        Logger.debug(TAG, "finishPeerConnection()")

        videoCapturer.stopCapture()

        localStream?.let {
            peerConnection?.removeStream(it)
        }

        peerConnection?.dispose()
    }
}

interface SurfaceViewCallback {
    fun onAddRemoteStream(mediaStream: MediaStream?)
    fun onRemoveRemoteStream(mediaStream: MediaStream?)
}

this is my messageListener:

} else if (jsonObject.has("rtc")) {
    val idChat = jsonObject.getStringOrNull("chat")
    val sender = jsonObject.getStringOrNull("sender")
    val rtcObject = jsonObject.getJSONObject("rtc")
    val rtcModel = WebRTCModel.RTCModel(
        type = rtcObject.getStringOrNull("type"),
        sdp = rtcObject.getStringOrNull("sdp"),
        from = rtcObject.getStringOrNull("_from"),
        candidate = rtcObject.getStringOrNull("candidate"),
        id = rtcObject.getStringOrNull("id"),
        label = rtcObject.getIntOrNull("label")
    )
    if (rtcObject.getStringOrNull("type").equals("hangup")) {
        callEndCallback?.callEnd(
            webRTCModel = WebRTCModel(
                chatId = idChat,
                sender = sender,
                rtc = rtcModel
            )
        )
        callPageCallback?.callEnd()
    } else {
        callPageCallback?.onMessage(
            webRTCModel = WebRTCModel(
                chatId = idChat,
                sender = sender,
                rtc = rtcModel
            )
        )
    }
}

One more thing iceConnectionChange callback changes to CHECKING after it accepts the user's iceCandidate.
And one more thing, the logs that appeared after receiving the offer may be useful:

D/RTCClient: onRemoteSessionDescriptionReceived() -> OFFER
D/RTCClient: Observer#onSignalingChange() -> HAVE_REMOTE_OFFER
D/RTCClient: Internal: (line 329): Elapsed time (163576 ms) longer than expected, limiting to 2000
     LS_WARNING pacing_controller.cc
D/RTCClient: Internal: (line 3446): Absent receive stream; ignoring clearing encoded frame sink for ssrc 0
     LS_ERROR webrtc_video_engine.cc
D/RTCClient: Observer#onAddStream() -> [gre6aHoVs2GaW0CM9m1Ava8gBe0ss2VhPbLY:A=1:V=1]
D/VideoCallComponent: onAddRemoteStream() -> [gre6aHoVs2GaW0CM9m1Ava8gBe0ss2VhPbLY:A=1:V=1]
D/RTCClient: InnerSdpObserver#onSetSuccess()
D/RTCClient: sendAnswer()
D/RTCClient: Internal: (line 936): RED codec red is missing an associated payload type.
     LS_WARNING media_session.cc
D/VideoCallComponent: VideoCall.Model#subscribe() -> Model(localStream=[ARDAMS:A=1:V=1], remoteStream=[gre6aHoVs2GaW0CM9m1Ava8gBe0ss2VhPbLY:A=1:V=1])
D/RTCClient: InnerSdpObserver#onCreateSuccess() -> org.webrtc.SessionDescription@cc58193
D/VideoScreen: model.subscribeAsState() -> Model(localStream=[ARDAMS:A=1:V=1], remoteStream=[gre6aHoVs2GaW0CM9m1Ava8gBe0ss2VhPbLY:A=1:V=1])
E/xoffice.androi: No package ID ff found for ID 0xffffffff.
D/RTCClient: Observer#onSignalingChange() -> STABLE
D/RTCClient: Observer#onRemoveTrack() -> org.webrtc.RtpReceiver@47e13a6
I/SurfaceView: onWindowVisibilityChanged(0) true org.webrtc.SurfaceViewRenderer{c0f21e7 V.E...... ......I. 0,0-0,0} of ViewRootImpl@643f65f[MainActivity]
D/RTCClient: Observer#onRemoveTrack() -> org.webrtc.RtpReceiver@2a3f43d
D/RTCClient: InnerSdpObserver#onSetSuccess()
D/RTCClient: onSetSuccess() -> createAnswer: user:ws:d8DHOnpJHYb6FC0VACHr

and after saving the answer in setLocalDescription:

D/RTCClient: Observer#onIceConnectionChange() -> CHECKING

The output of iceCandidates in the onIceCandidate method


问:
Node Express Mongo app goes sleep mode in shared cPanel
I deployed a Node js server with Express Js and MongoDB on NameCheap cPanel. The problem is I have to refresh 2 or 3 times to get the data from the server.Otherwise its gives 404. Then it works fine but after some minutes it acts the same. I have to refresh 2 or 3 times.
`

```<code>const express = require("express");
const { MongoClient } = require("mongodb");
const cors = require("cors");
require("dotenv").config();

const app = express();
const port = process.env.PORT || 5000;

//Middleware
app.use(cors());
app.use(express.json());

//MongoDB linking
const uri = `mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASS}@xyz`;
const client = new MongoClient(uri);

async function run() {
    try {
        await client.connect();
        //DB Folder and Subfolder
        const database = client.db("XYZ");
        const allUsers = database.collection("All-Users");

        app.get("/allusers", async (req, res) => {
            const get = allUsers.find({});
            const allData = await get.toArray();
            res.send(allData);
        });
    } finally {
        //await client.close();
    }
}
run().catch(console.dir);

app.get("/", (req, res) => {
    res.send(" Server is running just fine");
});

app.listen(port, () => {
    console.log(" server running on port :", port);
});

</code>```

`

I dont have idea what the problem is. Did anyone faced the same issue, and solved the issue?
Thank you.

Body:
I deployed a Node js server with Express Js and MongoDB on NameCheap cPanel. The problem is I have to refresh 2 or 3 times to get the data from the server.Otherwise its gives 404. Then it works fine but after some minutes it acts the same. I have to refresh 2 or 3 times.
`

const express = require("express");
const { MongoClient } = require("mongodb");
const cors = require("cors");
require("dotenv").config();

const app = express();
const port = process.env.PORT || 5000;

//Middleware
app.use(cors());
app.use(express.json());

//MongoDB linking
const uri = `mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASS}@xyz`;
const client = new MongoClient(uri);

async function run() {
    try {
        await client.connect();
        //DB Folder and Subfolder
        const database = client.db("XYZ");
        const allUsers = database.collection("All-Users");

        app.get("/allusers", async (req, res) => {
            const get = allUsers.find({});
            const allData = await get.toArray();
            res.send(allData);
        });
    } finally {
        //await client.close();
    }
}
run().catch(console.dir);

app.get("/", (req, res) => {
    res.send(" Server is running just fine");
});

app.listen(port, () => {
    console.log(" server running on port :", port);
});

`

I dont have idea what the problem is. Did anyone faced the same issue, and solved the issue?
Thank you.


问:
Plotly multplot not showing correctly
My plot does not perform correctly

```<code>for k in range(0,len(j)):
    fig = px.scatter(X_reduced_df, x='EXTRACTION_DATE_SAMPLE', y=[j[k]], title = "Größe " + str(k) +": " + j[k],
                     color= 'anomaly_class_IF', hover_data=['score_IF','delta', 'omicron', 'NH4-N (titr.)(W)_Zusatzparameter-ESRI',
                                                                          'P ges. filtr. (photom.)(W) mA_Zusatzparameter-ESRI',
                                                                                'BSB5 (mit Verd) DIN 1899_Zusatzparameter-ESRI',
                                                                                'N org. (Ber. TKN)(W)_Zusatzparameter-ESRI'
                                                                                ])

    fig.show()
</code>```

the result is

why do i get this? the date is not shown correctly, and as a consequence, the plot is empty.
i tried the plot without the loop and it works just fine. what can i do to fix this?

Title: Plotly multplot not showing correctly

Body:
My plot does not perform correctly

for k in range(0,len(j)):
    fig = px.scatter(X_reduced_df, x='EXTRACTION_DATE_SAMPLE', y=[j[k]], title = "Größe " + str(k) +": " + j[k],
                     color= 'anomaly_class_IF', hover_data=['score_IF','delta', 'omicron', 'NH4-N (titr.)(W)_Zusatzparameter-ESRI',
                                                                          'P ges. filtr. (photom.)(W) mA_Zusatzparameter-ESRI',
                                                                                'BSB5 (mit Verd) DIN 1899_Zusatzparameter-ESRI',
                                                                                'N org. (Ber. TKN)(W)_Zusatzparameter-ESRI'
                                                                                ])

    fig.show()

the result is

why do i get this? the date is not shown correctly, and as a consequence, the plot is empty.
i tried the plot without the loop and it works just fine. what can i do to fix this?


问:
Possible rate-limit on ReCaptcha Enterprise
We have a customer that said their contributors are rate-limited by ReCaptcha. We currently don't have error tracking on front-end, so we don't have more details at this moment

They use static IP and this only happens when there are multiple contributors trying to login to our system simultaneously

Is there somewhere in the ReCaptcha Console where we can check for more details or any setting to enable an IP Safelist?

Our ReCaptcha configuration has no WAF enabled. We've already checked metrics and logs, but we don't find anything useful for this scenario.

For now we are bypassing the backend validation for this customer.


问:
OpenCV - Verify Essential Matrix by Rotation and Translation (decomposeEssentialMat function)
I am trying to verify that the procedure I followed is correct.

I extracted the rotation matrices R1 and R2 and the translation vector T from the function: decomposeEssentialMat(essentialMatrix, R1, R2, t)

My theory is that I can then use R1 or R2 multiplied with Tx to get the essential matrix again by E = Tx*R

Hence I construct a skewed 3x3 matrix for Tx:

```<code>Tx = [ 0    -t(3)  t(2)
       t(3)  0    -t(1)
      -t(2)  t(1)   0 ]
</code>```

Followed by multiplying it with either R1 or R2. The result is nowhere close to the essential matrix I originally decomposed.

The procedure:
I compute the essential matrix from my fundamental matrix and camera calibrations. Since I use only one camera, the same parameters are inserted for refCam and auxCam (Cam1 and Cam2)
Camera Calibration Parameters

The essential matrix is then computed by: EssentialMatrix = refCamMat.t() * fundamental * auxCamMat;

Moving further I decompose the essentialMatrix by: decomposeEssentialMat(essentialMatrix, R1, R2, t)

I get R1 and R2 and 3x3 matrices, and t and 3x1 vector. I transform vector to skewed 3x3 matrix as follows:

```<code>Tx = [ 0    -t(3)  t(2)
       t(3)  0    -t(1)
      -t(2)  t(1)   0 ]
</code>```

I then perform simple matrix multiplication by Tx * R1 or Tx * R2

Yielding:

Input EssentialMatrix, R1, R2, t, Tx, Output EssentialMatrix

Clearly the output essential matrix does not match the input essential matrix. Also not with any scaling.

Any guidance? :/

I tried transposing and taking the inverse

Body:
I am trying to verify that the procedure I followed is correct.

I extracted the rotation matrices R1 and R2 and the translation vector T from the function: decomposeEssentialMat(essentialMatrix, R1, R2, t)

My theory is that I can then use R1 or R2 multiplied with Tx to get the essential matrix again by E = Tx*R

Hence I construct a skewed 3x3 matrix for Tx:

Tx = [ 0    -t(3)  t(2)
       t(3)  0    -t(1)
      -t(2)  t(1)   0 ]

Followed by multiplying it with either R1 or R2. The result is nowhere close to the essential matrix I originally decomposed.

The procedure:
I compute the essential matrix from my fundamental matrix and camera calibrations. Since I use only one camera, the same parameters are inserted for refCam and auxCam (Cam1 and Cam2)
Camera Calibration Parameters

The essential matrix is then computed by: EssentialMatrix = refCamMat.t() * fundamental * auxCamMat;

Moving further I decompose the essentialMatrix by: decomposeEssentialMat(essentialMatrix, R1, R2, t)

I get R1 and R2 and 3x3 matrices, and t and 3x1 vector. I transform vector to skewed 3x3 matrix as follows:

Tx = [ 0    -t(3)  t(2)
       t(3)  0    -t(1)
      -t(2)  t(1)   0 ]

I then perform simple matrix multiplication by Tx * R1 or Tx * R2

Yielding:

Input EssentialMatrix, R1, R2, t, Tx, Output EssentialMatrix

Clearly the output essential matrix does not match the input essential matrix. Also not with any scaling.

Any guidance? :/

I tried transposing and taking the inverse


问:
Azure Virtual Network - Could not access key vault reference metadata
I have a virtual network, with a key vault and a function app (both have been linked via private endpoints and the function app has outbound traffic VNet integration set up).

We are using RBAC for access to the Key Vault and the Function has a role assignment that grants Get and List access to the Secrets in the key vault.

The function is part of a premium app service plan (EP1).

The functions storage account is also set up as part of the VNET

The function has WEBSITE_CONTENTAZUREFILECONNECTIONSTRING, WEBSITE_CONTENTOVERVNET and WEBSITE_CONTENTSHARE app settings defined as I believe to be required by documentation ( https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings )

Example Key Vault Reference:

```<code>@Microsoft.KeyVault(SecretUri=https://mykeyvault.vault.azure.net/secrets/StorageAccountConnectionString/)
</code>```

The function has some settings set up as key vault references and at runtime they resolve just fine. However in the Azure Portal under the configuration tab for the function app I get the following error at the top.

```<code>Error: Could not access key vault reference metadata
</code>```

and there's no reference to any settings being a key vault reference under the source column. For what it's worth the configuration seems to take a while to actually load so I'm wondering if anything is timing out in the background (i.e. the portal can't resolve the key vault, but the actual function can).

So the question is, can I just ignore this error? Is it anything to worry about and finally is there anything I'm doing wrong?

Body:
I have a virtual network, with a key vault and a function app (both have been linked via private endpoints and the function app has outbound traffic VNet integration set up).

We are using RBAC for access to the Key Vault and the Function has a role assignment that grants Get and List access to the Secrets in the key vault.

The function is part of a premium app service plan (EP1).

The functions storage account is also set up as part of the VNET

The function has WEBSITE_CONTENTAZUREFILECONNECTIONSTRING, WEBSITE_CONTENTOVERVNET and WEBSITE_CONTENTSHARE app settings defined as I believe to be required by documentation ( https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings )

Example Key Vault Reference:

@Microsoft.KeyVault(SecretUri=https://mykeyvault.vault.azure.net/secrets/StorageAccountConnectionString/)

The function has some settings set up as key vault references and at runtime they resolve just fine. However in the Azure Portal under the configuration tab for the function app I get the following error at the top.

Error: Could not access key vault reference metadata

and there's no reference to any settings being a key vault reference under the source column. For what it's worth the configuration seems to take a while to actually load so I'm wondering if anything is timing out in the background (i.e. the portal can't resolve the key vault, but the actual function can).

So the question is, can I just ignore this error? Is it anything to worry about and finally is there anything I'm doing wrong?


问:
Import elements from multiple submodules
I have a python project with a package, where the tree looks like this:

```<code>my_package
├── __init__.py
├── A.py
└── B.py
</code>```

I would like to call several objects from A and B at once (from different files in the same command), is something "like" this posible?:

```<code>from my_package import ( # or some other syntax of course
    A_object_1,
    A_object_2,
    B_object_1
)
</code>```

Thanks

Body:
I have a python project with a package, where the tree looks like this:

my_package
├── __init__.py
├── A.py
└── B.py

I would like to call several objects from A and B at once (from different files in the same command), is something "like" this posible?:

from my_package import ( # or some other syntax of course
    A_object_1,
    A_object_2,
    B_object_1
)

Thanks


问:
Flutter: How to properly setup Pusher Beams when minimised or terminated?
Im struggling with this topic a few weeks. I registered on firebase console, pusher beams, everything setup as is written in documentation, I copied example project from flutter pusher_beams package so that when i send notification and app is opened, alert pop up and when is minimised, notification is shown in notification tray.

Problems:

When I tap on notification when app is minimised, i cannot check, which notification was tapped. I tried to add delay before that function but without help.
PusherBeams.instance.getInitialMessage is returning null, when i break there, but debugger dont stop on that breakpoint when i tap on notification when app is minimised.

I dont know how to handle notifications when app is killed. I found flutter_background_service, but when i set isForegroundMode to true, unhideable (if that word exists) notification is in notification tray and when i set isForegroundMode to false, when app is killed, that service is killed too. Another possibility is to use workmanager, but that can be called the fastest every 15 mins.

```<code>class _MyHomePageState extends State<MyHomePage> {
  @override
  initState() {
    super.initState();

    initPusherBeams();
  }

  initPusherBeams() async {
    // Let's see our current interests
    print(await PusherBeams.instance.getDeviceInterests());

    // This is not intented to use in web
    if (!kIsWeb) {
      await PusherBeams.instance
          .onInterestChanges((interests) => {
            print('Interests: $interests')});

      await PusherBeams.instance
          .onMessageReceivedInTheForeground(_onMessageReceivedInTheForeground);
    }
    await _checkForInitialMessage();
  }

  Future<void> _checkForInitialMessage() async {
    await Future.delayed(const Duration(seconds: 1));
    final initialMessage = await PusherBeams.instance.getInitialMessage();
    if (initialMessage != null) {
      _showAlert('Initial Message Is:', initialMessage.toString());
    }
  }

  void _onMessageReceivedInTheForeground(Map<Object?, Object?> data) {
    _showAlert(data["title"].toString(), data["body"].toString());
  }

  void _showAlert(String title, String message) {
    AlertDialog alert = AlertDialog(
        title: Text(title), content: Text(message), actions: const []);

    showDialog(
      context: context,
      builder: (BuildContext context) {
        return alert;
      },
    );
  }
</code>```

Body:
Im struggling with this topic a few weeks. I registered on firebase console, pusher beams, everything setup as is written in documentation, I copied example project from flutter pusher_beams package so that when i send notification and app is opened, alert pop up and when is minimised, notification is shown in notification tray.

Problems:

When I tap on notification when app is minimised, i cannot check, which notification was tapped. I tried to add delay before that function but without help.
PusherBeams.instance.getInitialMessage is returning null, when i break there, but debugger dont stop on that breakpoint when i tap on notification when app is minimised.

I dont know how to handle notifications when app is killed. I found flutter_background_service, but when i set isForegroundMode to true, unhideable (if that word exists) notification is in notification tray and when i set isForegroundMode to false, when app is killed, that service is killed too. Another possibility is to use workmanager, but that can be called the fastest every 15 mins.

class _MyHomePageState extends State<MyHomePage> {
  @override
  initState() {
    super.initState();

    initPusherBeams();
  }

  initPusherBeams() async {
    // Let's see our current interests
    print(await PusherBeams.instance.getDeviceInterests());

    // This is not intented to use in web
    if (!kIsWeb) {
      await PusherBeams.instance
          .onInterestChanges((interests) => {
            print('Interests: $interests')});

      await PusherBeams.instance
          .onMessageReceivedInTheForeground(_onMessageReceivedInTheForeground);
    }
    await _checkForInitialMessage();
  }

  Future<void> _checkForInitialMessage() async {
    await Future.delayed(const Duration(seconds: 1));
    final initialMessage = await PusherBeams.instance.getInitialMessage();
    if (initialMessage != null) {
      _showAlert('Initial Message Is:', initialMessage.toString());
    }
  }

  void _onMessageReceivedInTheForeground(Map<Object?, Object?> data) {
    _showAlert(data["title"].toString(), data["body"].toString());
  }

  void _showAlert(String title, String message) {
    AlertDialog alert = AlertDialog(
        title: Text(title), content: Text(message), actions: const []);

    showDialog(
      context: context,
      builder: (BuildContext context) {
        return alert;
      },
    );
  }


问:
Astroquery.jplhorizons not working on Windows
The astroquery.horizons package includes this code in the documentation:

```<code>>>> from astroquery.jplhorizons import Horizons
>>> obj = Horizons(id='Ceres', location='568',
...                epochs={'start':'2010-01-01', 'stop':'2010-03-01',
...                        'step':'10d'})
>>> eph = obj.ephemerides()
</code>```

This runs on my macbook, but fails on my windows computer.

The error on my windows computer is exactly as described in
this github issue. I have the most recent version of astroquery, 0.4.6.

Does anyone have any idea what might be going on here?

Body:
The astroquery.horizons package includes this code in the documentation:

>>> from astroquery.jplhorizons import Horizons
>>> obj = Horizons(id='Ceres', location='568',
...                epochs={'start':'2010-01-01', 'stop':'2010-03-01',
...                        'step':'10d'})
>>> eph = obj.ephemerides()

This runs on my macbook, but fails on my windows computer.

The error on my windows computer is exactly as described in
this github issue. I have the most recent version of astroquery, 0.4.6.

Does anyone have any idea what might be going on here?


问:
How to change QTextCursor height while typing near by image inside QTextEdit?
It is possible to change height of QTextCursor when typing typing near by image inside text field? As you see, when typing before image the linespacing is different (same as image height). If press Enter button or paste new line char("\n") it's ok. I've tried to change lineHeight and etc but it

I've tried to change lineHeight and etc but it doesn gave any result
So what property of QTextCursor responsing for this? Or what i should change?
Thank you!


问:
How to fix layout border?
Wassup, I'm having a little problem with neo-blessed/blessed module when the layout resize. When i resize the window, screen has a event that resize all layouts automatically, but when it happens the border of some layout not resize correctly. How can i fix it?

This is my code

```<code>let screen = blessed.screen({
   smartCSR: true,
   autoPadding: true
})

main = blessed.form({
   top: 'center',
   left: 'center',
   width: '100%',
   height: '100%',
   tags: true,
   border: {
      type: 'line'
   },
   style: {
      border: {
      fg: 'white'
      }
   }
})

screen.append(main)

overmain = blessed.form({
   parent: main,
   top: '0%',
   left: 'center',
   width: '99%',
   height: '20%',
   tags: true,
   border: {
      type: 'line'
   },
   style: {
      border: {
      fg: 'white'
      }
   }
})

screen.on('resize', () => {
   main.emit('attach')
   overmain.emit('attach')
})

screen.on('keypress', (ch, key) => {
   if(key.name == 'tab') return process.exit(0)
})
</code>```

enter image description here

Title: How to fix layout border?

Body:
Wassup, I'm having a little problem with neo-blessed/blessed module when the layout resize. When i resize the window, screen has a event that resize all layouts automatically, but when it happens the border of some layout not resize correctly. How can i fix it?

This is my code

let screen = blessed.screen({
   smartCSR: true,
   autoPadding: true
})

main = blessed.form({
   top: 'center',
   left: 'center',
   width: '100%',
   height: '100%',
   tags: true,
   border: {
      type: 'line'
   },
   style: {
      border: {
      fg: 'white'
      }
   }
})

screen.append(main)

overmain = blessed.form({
   parent: main,
   top: '0%',
   left: 'center',
   width: '99%',
   height: '20%',
   tags: true,
   border: {
      type: 'line'
   },
   style: {
      border: {
      fg: 'white'
      }
   }
})

screen.on('resize', () => {
   main.emit('attach')
   overmain.emit('attach')
})

screen.on('keypress', (ch, key) => {
   if(key.name == 'tab') return process.exit(0)
})

enter image description here


问:
Set default value for list of objects in properties
Is it possible to set a default value for list of objects in properties?</p>
```<code>public class GameLevel
{
    public int nextLevelToUnlock { get; set; } = 1;
    public List<LevelDetails> levelDetails { get; set; }
}

public class LevelDetails
{
    public int levelIndex { get; set; }
    public int Stars { get; set; }
}
</code>```

Body:
Is it possible to set a default value for list of objects in properties?

public class GameLevel
{
    public int nextLevelToUnlock { get; set; } = 1;
    public List<LevelDetails> levelDetails { get; set; }
}

public class LevelDetails
{
    public int levelIndex { get; set; }
    public int Stars { get; set; }
}


问:
How to store API response in react without re-render?
I have the following use case. I am getting array data from an API.

Sample API response : {key1: value1, key2: value2, key3: value3}

I have the following webpage (all 3 are radio buttons).

Key1

Key2

Key3

When a user clicks on above radio button, corresponding value from API response should be displayed to the right.

I was thinking of storing the API response in a ref (not using state to avoid re-renders, not using local variable to persist data between re-renders, the API response can be updated in between based on some user action). There is also a state variable that shows the value array. So, if the key1 radio button is selected, the state variable will be [value1, , ]. Could you please tell if there is some better approach than this?

Edit 1 :

What is the goal with preventing the re-render?

The re-render need not happen when the API response is returned but only when radio button is clicked.

Also, how do you plan to display the response data from the API without a re-render?

Radio button => linked to state value (which retrieves from ref) => re-render.
I didn't want re-render when API response is returned which could be other user actions than radio button click.

Edit 2 :

Why not have one state object that contains all the data and links each key to it's corresponding radio-button?

The API response of key value pairs could be retrieved in between as well due to some other action (even few key value pairs can be updated in between). But only when the radio button is clicked, the value should be displayed.


问:
Change JSON format in react
Is there a way to change a JSON's data in order to make it compatible with a libraries input?
More particularly, I am trying to use react-jsonschema-form to create a form in my react app. However, the schema I am getting from my endpoint is different for the schema needed in the library.

My JSON schema:

```<code>{
    "components": [
        {
            "disabled": false,
            "id": "Field_0m3bj1n",
            "key": "name",
            "label": "name",
            "type": "textfield",
            "validate": {
                "required": true
            }
        },
        {
            "id": "Field_0mauz9k",
            "key": "surname",
            "label": "surname",
            "type": "textfield",
            "validate": {
                "required": true
            }
        },
        {
            "id": "Field_04ocl1x",
            "key": "telephone",
            "label": "telephone",
            "type": "textfield",
            "validate": {
                "required": true
            }
        }
    ],
    "executionPlatform": "Camunda Cloud",
    "executionPlatformVersion": "8.1.0",
    "exporter": {
        "name": "Camunda Modeler",
        "version": "5.5.1"
    },
    "id": "Form1",
    "schemaVersion": 5,
    "type": "default"
}
</code>```

The required schema:

```<code>{
    "description": "A simple form example.",
    "properties": {
        "name": {
            "default": "Chuck",
            "title": "First name",
            "type": "string"
        },
        "surname": {
            "title": "Last name",
            "type": "string"
        },
        "telephone": {
            "minLength": 10,
            "title": "Telephone",
            "type": "string"
        }
    },
    "required": [
        "name",
        "surname"
    ],
    "title": "A registration form",
    "type": "object"
}
</code>```

Is there any way to convert my schema to the second one?
Thank you!

Title: Change JSON format in react

Body:
Is there a way to change a JSON's data in order to make it compatible with a libraries input?
More particularly, I am trying to use react-jsonschema-form to create a form in my react app. However, the schema I am getting from my endpoint is different for the schema needed in the library.

My JSON schema:

{
    "components": [
        {
            "disabled": false,
            "id": "Field_0m3bj1n",
            "key": "name",
            "label": "name",
            "type": "textfield",
            "validate": {
                "required": true
            }
        },
        {
            "id": "Field_0mauz9k",
            "key": "surname",
            "label": "surname",
            "type": "textfield",
            "validate": {
                "required": true
            }
        },
        {
            "id": "Field_04ocl1x",
            "key": "telephone",
            "label": "telephone",
            "type": "textfield",
            "validate": {
                "required": true
            }
        }
    ],
    "executionPlatform": "Camunda Cloud",
    "executionPlatformVersion": "8.1.0",
    "exporter": {
        "name": "Camunda Modeler",
        "version": "5.5.1"
    },
    "id": "Form1",
    "schemaVersion": 5,
    "type": "default"
}

The required schema:

{
    "description": "A simple form example.",
    "properties": {
        "name": {
            "default": "Chuck",
            "title": "First name",
            "type": "string"
        },
        "surname": {
            "title": "Last name",
            "type": "string"
        },
        "telephone": {
            "minLength": 10,
            "title": "Telephone",
            "type": "string"
        }
    },
    "required": [
        "name",
        "surname"
    ],
    "title": "A registration form",
    "type": "object"
}

Is there any way to convert my schema to the second one?
Thank you!


问:
How to consistently display PDF in a webpage using JavaScript
I am having trouble getting JavaScript to consistently display PDFs in a webpage.
Some PDFs display without problem but some just bring up a white page with no error messages.

PDFs are uploaded by users using a C# WinForms application and are stored in a SQL server table using a VARBINARY(MAX) datatype. These PDFs are then made available to a webpage via an API call.
The code to read the PDF into a byte array is:

```<code>byte[] file;
using (var stream = new FileStream(DocumentTextBox.Text, FileMode.Open, FileAccess.Read))
        {
            using (var reader = new BinaryReader(stream))
            {
                file = reader.ReadBytes((int)stream.Length);
            }
        }
</code>```

The JavaScript code I have to call the API, convert the response into a base64, encoded URI and then write to a new webpage is:

```<code>const response = await postData(API_URL + 'GetDocument/', data);
const exam = await response.json();

let pdfWindow = window.open("")
pdfWindow.document.write("<iframe width='100%' height='100%' src='data:applicaton/pdf;base64, " + encodeURI(exam) + "'></iframe>")
</code>```

For the API call, the data object contains the GUID of the PDF to be displayed.

Some of the main changes I have tried are:

PDF.js - I want the files to be displayed as PDFs, not images, so that users can interact with them normally

Replacing the iframe with embed - could only get it so that it would display a "Request URI too long" error

Removing base64 from the src - this broke all PDFs

Because of the IT security setup, I am not allowed to store the PDFs in a fileshare so storing in a database and using an API is the option to make the PDFs available to the webpage.

Having spent over a week trying numerous changes, I would appreciate some advice about how to resolve this problem

Thanks

Body:
I am having trouble getting JavaScript to consistently display PDFs in a webpage.
Some PDFs display without problem but some just bring up a white page with no error messages.

PDFs are uploaded by users using a C# WinForms application and are stored in a SQL server table using a VARBINARY(MAX) datatype. These PDFs are then made available to a webpage via an API call.
The code to read the PDF into a byte array is:

byte[] file;
using (var stream = new FileStream(DocumentTextBox.Text, FileMode.Open, FileAccess.Read))
        {
            using (var reader = new BinaryReader(stream))
            {
                file = reader.ReadBytes((int)stream.Length);
            }
        }

The JavaScript code I have to call the API, convert the response into a base64, encoded URI and then write to a new webpage is:

const response = await postData(API_URL + 'GetDocument/', data);
const exam = await response.json();

let pdfWindow = window.open("")
pdfWindow.document.write("")

For the API call, the data object contains the GUID of the PDF to be displayed.

Some of the main changes I have tried are:

PDF.js - I want the files to be displayed as PDFs, not images, so that users can interact with them normally

Replacing the iframe with embed - could only get it so that it would display a "Request URI too long" error

Removing base64 from the src - this broke all PDFs

Because of the IT security setup, I am not allowed to store the PDFs in a fileshare so storing in a database and using an API is the option to make the PDFs available to the webpage.

Having spent over a week trying numerous changes, I would appreciate some advice about how to resolve this problem

Thanks


问:
ValueError: X has 4 features per sample; expecting 32
I am having a little challenge here. The following code is returning a Valueerror when running ValueError: X has 4 features per sample; expecting 32

Not sure why as I already looked at the other topics related to that matter. I checked my df frame size which is indeed 1x4 (which matches the number of inputs given to the model). I am also saving the model into a separate file with pickle to avoid any matter as usually recommended.

Still, that does not seem to work. Would you have any idea on how to fix that? I am clueless regarding the origin of the error here.

```<code>
import pandas as pd

from sklearn.model_selection import train_test_split

from sklearn import linear_model

from sklearn.preprocessing import MinMaxScaler

import pickle

df_raw = pd.read_csv('\\Users\\rapha\\Desktop\\Consulting\\Poker\\Tables test\\Final model\\Regressions DONE\SB Allpro DB - a1_preflop flag1 & 2 & 3 V1.csv', sep=";")

#Select categorical features only & use binary encoding

feature_cols1 = ['tiers','score','proba_preflop','proba2_preflop','action1_preflop']

df_raw = df_raw[feature_cols1]
df_backup = df_raw['action1_preflop']
cat_features = df_raw.select_dtypes(include=[object])

num_features = df_raw.select_dtypes(exclude=[object])
num_features = num_features.drop(['action1_preflop'], axis=1)
df = num_features.join(pd.get_dummies(cat_features))
df = df.join(df_backup)

df_outcome = df.action1_preflop
df_variables_mid = df.drop('action1_preflop',axis=1)

col_names = list(df_variables_mid.columns)
scaler = MinMaxScaler()
df_variables_minmax = scaler.fit_transform(df_variables_mid)
df_variables = pd.DataFrame(df_variables_minmax,columns = col_names)

x = df_variables
y = df.action1_preflop

x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.2,random_state=1)

lm = linear_model.LogisticRegression(multi_class='multinomial', solver='saga', max_iter=1000)

lm.fit(x_train, y_train)

filename = 'SBmodel_preflop_a1.sav'
pickle.dump(lm, open(filename, 'wb'))

# some time later...

# load the model from disk
loaded_model = pickle.load(open(filename, 'rb'))
result = loaded_model.score(x_test, y_test)

pred_cols1 = ['tiers','score','proba_preflop','proba2_preflop']

df_pred = pd.DataFrame(columns= pred_cols1)

df_pred.loc[1] = pd.Series({'tiers':'tiers4', 'score':'score2', 'proba_preflop':0.2224, 'proba2_preflop':3})

cat_features = df_pred.select_dtypes(include=[object])
num_features = df_pred.select_dtypes(exclude=[object])
df_pred = num_features.join(pd.get_dummies(cat_features))

result = loaded_model.predict(df_pred)

</code>```

Below is the traceback

```<code>
  File "C:\Users\rapha\Desktop\Consulting\Poker\Tables test\Final model\Regressions DONE\Logreg_SB_preflop_a1 DONE V1.py", line 83, in <module>
    result = loaded_model.predict(df_pred)

  File "C:\Users\rapha\anaconda3\lib\site-packages\sklearn\linear_model\_base.py", line 293, in predict
    scores = self.decision_function(X)

  File "C:\Users\rapha\anaconda3\lib\site-packages\sklearn\linear_model\_base.py", line 273, in decision_function
    % (X.shape[1], n_features))

ValueError: X has 4 features per sample; expecting 32

</code>```

Body:
I am having a little challenge here. The following code is returning a Valueerror when running ValueError: X has 4 features per sample; expecting 32

Not sure why as I already looked at the other topics related to that matter. I checked my df frame size which is indeed 1x4 (which matches the number of inputs given to the model). I am also saving the model into a separate file with pickle to avoid any matter as usually recommended.

Still, that does not seem to work. Would you have any idea on how to fix that? I am clueless regarding the origin of the error here.

import pandas as pd

from sklearn.model_selection import train_test_split

from sklearn import linear_model

from sklearn.preprocessing import MinMaxScaler

import pickle

df_raw = pd.read_csv('\\Users\\rapha\\Desktop\\Consulting\\Poker\\Tables test\\Final model\\Regressions DONE\SB Allpro DB - a1_preflop flag1 & 2 & 3 V1.csv', sep=";")

#Select categorical features only & use binary encoding

feature_cols1 = ['tiers','score','proba_preflop','proba2_preflop','action1_preflop']

df_raw = df_raw[feature_cols1]
df_backup = df_raw['action1_preflop']
cat_features = df_raw.select_dtypes(include=[object])

num_features = df_raw.select_dtypes(exclude=[object])
num_features = num_features.drop(['action1_preflop'], axis=1)
df = num_features.join(pd.get_dummies(cat_features))
df = df.join(df_backup)

df_outcome = df.action1_preflop
df_variables_mid = df.drop('action1_preflop',axis=1)

col_names = list(df_variables_mid.columns)
scaler = MinMaxScaler()
df_variables_minmax = scaler.fit_transform(df_variables_mid)
df_variables = pd.DataFrame(df_variables_minmax,columns = col_names)

x = df_variables
y = df.action1_preflop

x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.2,random_state=1)

lm = linear_model.LogisticRegression(multi_class='multinomial', solver='saga', max_iter=1000)

lm.fit(x_train, y_train)

filename = 'SBmodel_preflop_a1.sav'
pickle.dump(lm, open(filename, 'wb'))

# some time later...

# load the model from disk
loaded_model = pickle.load(open(filename, 'rb'))
result = loaded_model.score(x_test, y_test)

pred_cols1 = ['tiers','score','proba_preflop','proba2_preflop']

df_pred = pd.DataFrame(columns= pred_cols1)

df_pred.loc[1] = pd.Series({'tiers':'tiers4', 'score':'score2', 'proba_preflop':0.2224, 'proba2_preflop':3})

cat_features = df_pred.select_dtypes(include=[object])
num_features = df_pred.select_dtypes(exclude=[object])
df_pred = num_features.join(pd.get_dummies(cat_features))

result = loaded_model.predict(df_pred)

Below is the traceback

  File "C:\Users\rapha\Desktop\Consulting\Poker\Tables test\Final model\Regressions DONE\Logreg_SB_preflop_a1 DONE V1.py", line 83, in <module>
    result = loaded_model.predict(df_pred)

  File "C:\Users\rapha\anaconda3\lib\site-packages\sklearn\linear_model\_base.py", line 293, in predict
    scores = self.decision_function(X)

  File "C:\Users\rapha\anaconda3\lib\site-packages\sklearn\linear_model\_base.py", line 273, in decision_function
    % (X.shape[1], n_features))

ValueError: X has 4 features per sample; expecting 32


问:
card Animate effect on scroll https://www.bluelabellabs.com/work/delve/
I want to animate three cards on scrolling, like in website (The Result section card animation)

I used transform for align the card like steps in my html code

JavaScript Code

```<code>  // Change Card Postion On Scroll
  window.addEventListener('scroll', () => {
    const cardOne = document.getElementById("box_one")
    const cardTwo = document.getElementById("box_two")
    const cardThree = document.getElementById("box_three")
    const scrollYValue = window.scrollY;

    $(window).scroll(function () {
      if ($(window).scrollTop() > $('body').height() / 2) {
        const cardOne = document.getElementById("box_one")
        const cardTwo = document.getElementById("box_two")
        const cardThree = document.getElementById("box_three")
        const scrollYValue = window.scrollY / 10;

        $(window).scroll(function() {
          var position = $(window).scrollTop();
          var scroll = $(window).scrollTop();
            // console.log(scroll, position);
            if (scroll >= position) {
              console.log("Up");
                // cardOne.style.transform = "translate3d(0px, " + -scrollYValue / 200 + "em, 0px)",
                // cardTwo.style.transform = "translate3d(0px, " + -scrollYValue / 600 + "em, 0px)",
                // cardThree.style.transform = `translateY(${scrollYValue / 30}px)`

                cardOne.style.top = `${-scrollYValue}em`
              } else if (scroll <= position) {
                console.log("back");
                cardOne.style.transform = "translate3d(0px, " + scrollYValue  + "px, 0px)",
                cardTwo.style.transform = `translateY(${-scrollYValue / 90}px)`
                cardThree.style.transform = `translateY(${-scrollYValue / 30}px)`
            }
            position = scroll;
        });
      }
    });
  })
};
</code>```

Body:
I want to animate three cards on scrolling, like in website (The Result section card animation)

I used transform for align the card like steps in my html code

JavaScript Code

  // Change Card Postion On Scroll
  window.addEventListener('scroll', () => {
    const cardOne = document.getElementById("box_one")
    const cardTwo = document.getElementById("box_two")
    const cardThree = document.getElementById("box_three")
    const scrollYValue = window.scrollY;

    $(window).scroll(function () {
      if ($(window).scrollTop() > $('body').height() / 2) {
        const cardOne = document.getElementById("box_one")
        const cardTwo = document.getElementById("box_two")
        const cardThree = document.getElementById("box_three")
        const scrollYValue = window.scrollY / 10;

        $(window).scroll(function() {
          var position = $(window).scrollTop();
          var scroll = $(window).scrollTop();
            // console.log(scroll, position);
            if (scroll >= position) {
              console.log("Up");
                // cardOne.style.transform = "translate3d(0px, " + -scrollYValue / 200 + "em, 0px)",
                // cardTwo.style.transform = "translate3d(0px, " + -scrollYValue / 600 + "em, 0px)",
                // cardThree.style.transform = `translateY(${scrollYValue / 30}px)`

                cardOne.style.top = `${-scrollYValue}em`
              } else if (scroll <= position) {
                console.log("back");
                cardOne.style.transform = "translate3d(0px, " + scrollYValue  + "px, 0px)",
                cardTwo.style.transform = `translateY(${-scrollYValue / 90}px)`
                cardThree.style.transform = `translateY(${-scrollYValue / 30}px)`
            }
            position = scroll;
        });
      }
    });
  })
};


问:
How to run menu with options?
I made a program to show options in menu when you select a number.The menu should
be displayed after execution of each option prompting the user to enter value for one of
the options. The program should end only when the valid entry for exiting the program is
provided by the user. The program execute the menu, but how I can display each option, when you enter value for one of the options?</p>
```<code>
import java.util.Scanner;

public class menu {

    private static String options;

    public static void main(String[] args) {
        System.out.println("Choose from the Menu");
        System.out.println("-------------------------\n");
        System.out.println("1 - Create class list");
        System.out.println("2 - Provide marks for a subject");
        System.out.println("3 - Get grade statistics for a subject");
        System.out.println("4 - Exit");

        options = null;
        try (Scanner scan = new Scanner(System.in)) { // Capturing the input
            do {
                options = scan.nextLine();
                switch (options) {

                case "1":
                    // Perform "Create class list" case.

                    break;

                case "2":
                    // Perform "Provide marks for a subject" case.

                    break;

                case "3":
                    // Perform "Get grade statistics for a subject" case.

                    break;

                case "4":
                    // Perform "Exit" case.

                    break;

                }
            } while (options != "4"); // If no options Exit
        }

    }
}
</code>```

Title: How to run menu with options?

Body:
I made a program to show options in menu when you select a number.The menu should
be displayed after execution of each option prompting the user to enter value for one of
the options. The program should end only when the valid entry for exiting the program is
provided by the user. The program execute the menu, but how I can display each option, when you enter value for one of the options?

import java.util.Scanner;

public class menu {

    private static String options;

    public static void main(String[] args) {
        System.out.println("Choose from the Menu");
        System.out.println("-------------------------\n");
        System.out.println("1 - Create class list");
        System.out.println("2 - Provide marks for a subject");
        System.out.println("3 - Get grade statistics for a subject");
        System.out.println("4 - Exit");

        options = null;
        try (Scanner scan = new Scanner(System.in)) { // Capturing the input
            do {
                options = scan.nextLine();
                switch (options) {

                case "1":
                    // Perform "Create class list" case.

                    break;

                case "2":
                    // Perform "Provide marks for a subject" case.

                    break;

                case "3":
                    // Perform "Get grade statistics for a subject" case.

                    break;

                case "4":
                    // Perform "Exit" case.

                    break;

                }
            } while (options != "4"); // If no options Exit
        }

    }
}


问:
Cron email only contains the last line of stdout
Running dehydrated through crontab as follows I noticed that while all stdout is written to file. The email sent by cron only contains the last line of the stdout.

```<code>MAILTO=me@domain.com

# Run daily as root close to midnight 01:05
5 1 * * * root /usr/bin/dehydrated -c >> /var/log/dehydrated-cron.log; /usr/bin/systemctl reload nginx
</code>```

What are my options to get the whole output? Or do I just need to succumb and use a script that does it all and then run that in silent cronjob?

Body:
Running dehydrated through crontab as follows I noticed that while all stdout is written to file. The email sent by cron only contains the last line of the stdout.

MAILTO=me@domain.com

# Run daily as root close to midnight 01:05
5 1 * * * root /usr/bin/dehydrated -c >> /var/log/dehydrated-cron.log; /usr/bin/systemctl reload nginx

What are my options to get the whole output? Or do I just need to succumb and use a script that does it all and then run that in silent cronjob?


问:
Different product types, different subcategories database scheme
I am looking for a solution to get this products in a proper database scheme.
Main goal is to create a cascading Form to select the correct product.

So first select main product: (Books, Clothes, Shelves)
Based on selection from above another field is shown to ie. books to select covertype.

enter image description here

So many types of products, each with one or more variables. No idea how to set up my DB.

Tried to create simple table with column main-category, first-sub, second-sub, ...
but don't know how to fill my dropdownbox only with unique values from a column.


问:
How to save new data to current excel file
It exist an excel file at my path: E:\g1.xlsx
I want to add value to this file.

but my function always create new file:

```<code>Function wirteToExcelFile(path, sheet)
Dim oApp_Excel As Excel.Application
Dim oBook As Excel.Workbook

Set oApp_Excel = CreateObject("EXCEL.APPLICATION")
Set oBook = oApp_Excel.Workbooks.Add

oBook.Sheets("Sheet1").Cells(5, 3).Value = "masouud1"
oBook.SaveAs (path)
oBook.Close
oApp_Excel.Quit

Set oBook = Nothing
End Function
</code>```

Body:
It exist an excel file at my path: E:\g1.xlsx
I want to add value to this file.

but my function always create new file:

Function wirteToExcelFile(path, sheet)
Dim oApp_Excel As Excel.Application
Dim oBook As Excel.Workbook

Set oApp_Excel = CreateObject("EXCEL.APPLICATION")
Set oBook = oApp_Excel.Workbooks.Add

oBook.Sheets("Sheet1").Cells(5, 3).Value = "masouud1"
oBook.SaveAs (path)
oBook.Close
oApp_Excel.Quit

Set oBook = Nothing
End Function


问:
Pyspark dataframe conditional filter and imputation
I have a pyspark dataframe df

ID
Total_Count
A
B
C
D
Group
Name
Chain

1
56
0
0
0
0
1
Apple
Fruits1

2
65
0
0
0
0
1
Apple
Fruits1

3
72
0
0
30
0
1
Banana
Fruits1

4
80
0
0
0
0
1
Strawberry
Fruits1

5
142
58
58
14
12
1
Apple
Fruits1

6
130
63
50
9
8
1
Apple
Fruits1

7
145
74
44
17
10
1
Apple
Fruits1

8
119
54
48
8
9
1
Apple
Fruits1

11
161
71
63
16
11
1
Banana
Fruits1

12
124
54
43
19
8
1
Banana
Fruits1

I want to impute the A,B,C,D columns wherever there is 0 in A,B,C,D columns(ID 1,2,3,4).

1.) Logic : Average of GroupxName(if available) or Average of GroupxChain(if available) or at Average of Group :

Taking the example to impute ID 1,2 for demo:
Post filering for Group 1 and Name Apple, Proportion for ID 1&2 is obtained as follows( For ID 1 and 2  resp. filtering rows with similar Group as 1 and similar Name (Apple)) ,proportion is calculated as A/Total_Count, B/Total_Count and so on :

A_PROP
B_PROP
C_PROP
D_PROP

0.408451
0.408450704
0.098592
0.084507042

0.484615
0.384615385
0.069231
0.061538462

0.510345
0.303448276
0.117241
0.068965517

0.453782
0.403361345
0.067227
0.075630252

2.) Average of the above 4 rows is to be taken (for ID 1 & 2 for example).
A,B,C,D in df2 is calcualted as X_prop_avg*Total_Count.

Expected output (df2) :

ID
Total_Count
A_prop_avg
B_prop_avg
C_prop_avg
D_prop_avg
A
B
C
D

1
56
0.46429811
0.37496893
0.08807265
0.07266032
26
21
5
4

2
65
0.464298107
0.374968927
0.088072647
0.072660318
30
24
6
5

3
72
0.43823883
0.369039271
0.126302344
0.066419555
32
27
9
5

4
80
0.455611681
0.372992375
0.10081588
0.070580064
36
30
8
6


问:
I have installed ansible using yum, but getting error ImportError: cannot import name AnsibleCollectionLoader
I have installed ansible using yum install ansible on CENTOS7
`

```<code>Installed:
  ansible.noarch 0:2.9.27-1.el7
</code>```

`

But
ansible --version gives below error
`

```<code>ERROR! Unexpected Exception, this is probably a bug: cannot import name AnsibleCollectionLoader
the full traceback was:

Traceback (most recent call last):
  File "/bin/ansible", line 92, in <module>
    mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
  File "/usr/lib/python2.7/site-packages/ansible/cli/__init__.py", line 22, in <module>
    from ansible.inventory.manager import InventoryManager
  File "/usr/lib/python2.7/site-packages/ansible/inventory/manager.py", line 38, in <module>
    from ansible.plugins.loader import inventory_loader
  File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 26, in <module>
    from ansible.utils.collection_loader import AnsibleCollectionLoader, AnsibleFlatMapLoader, AnsibleCollectionRef
ImportError: cannot import name AnsibleCollectionLoader
</code>```

`

The same was working previously.

`

```<code>ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/centos/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 28 2022, 15:30:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
</code>```

`

Body:
I have installed ansible using yum install ansible on CENTOS7
`

Installed:
  ansible.noarch 0:2.9.27-1.el7

`

But
ansible --version gives below error
`

ERROR! Unexpected Exception, this is probably a bug: cannot import name AnsibleCollectionLoader
the full traceback was:

Traceback (most recent call last):
  File "/bin/ansible", line 92, in <module>
    mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
  File "/usr/lib/python2.7/site-packages/ansible/cli/__init__.py", line 22, in <module>
    from ansible.inventory.manager import InventoryManager
  File "/usr/lib/python2.7/site-packages/ansible/inventory/manager.py", line 38, in <module>
    from ansible.plugins.loader import inventory_loader
  File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 26, in <module>
    from ansible.utils.collection_loader import AnsibleCollectionLoader, AnsibleFlatMapLoader, AnsibleCollectionRef
ImportError: cannot import name AnsibleCollectionLoader

`

The same was working previously.

`

ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/centos/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 28 2022, 15:30:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

`


问:
Dispatcher.useSyncExternalStore is not a function
I have no idea how to troubleshoot this error. This started happening when I was trying to install the react-native-imaged-card-view package and forced some dependencies. I think I broke something. Please help me.</p>
```<code>TypeError: dispatcher.useSyncExternalStore is not a function. (In 'dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)', 'dispatcher.useSyncExternalStore' is undefined)

This error is located at:
    in ExpoStatusBar (created by LandingPage)
    in RCTView (created by View)
    in View (created by LandingPage)
    in LandingPage (created by SceneView)
    in StaticContainer
    in EnsureSingleNavigator (created by SceneView)
    in SceneView (created by SceneView)
    in RCTView (created by View)
    in View (created by DebugContainer)
    in DebugContainer (created by MaybeNestedStack)
    in MaybeNestedStack (created by SceneView)
    in RNSScreen (created by AnimatedComponent)
    in AnimatedComponent
    in AnimatedComponentWrapper (created by Screen)
    in MaybeFreeze (created by Screen)
    in Screen (created by SceneView)
    in SceneView (created by NativeStackViewInner)
    in RNSScreenStack (created by ScreenStack)
    in ScreenStack (created by NativeStackViewInner)
    in NativeStackViewInner (created by NativeStackView)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by SafeAreaInsetsContext)
    in SafeAreaProviderCompat (created by NativeStackView)
    in NativeStackView (created by NativeStackNavigator)
    in Unknown (created by NativeStackNavigator)
    in NativeStackNavigator (created by AuthStack)
    in AuthStack (created by Routes)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by Routes)
    in Routes (created by Providers)
    in AuthProvider (created by Providers)
    in Providers (created by App)
    in App (created by ExpoRoot)
    in ExpoRoot
    in RCTView (created by View)
    in View (created by AppContainer)
    in DevAppContainer (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/ReactFiberErrorDialog.js:43:2 in showErrorDialog
at navigation/AuthProvider.js:32:13 in stateChanged
at navigation/AuthProvider.js:31:25 in stateChanged
at node_modules/@firebase/util/dist/index.esm2017.js:1150:0 in <global>
at node_modules/@firebase/util/dist/index.esm2017.js:1312:13 in Sha1#compress_
</code>```

Body:
I have no idea how to troubleshoot this error. This started happening when I was trying to install the react-native-imaged-card-view package and forced some dependencies. I think I broke something. Please help me.

TypeError: dispatcher.useSyncExternalStore is not a function. (In 'dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)', 'dispatcher.useSyncExternalStore' is undefined)

This error is located at:
    in ExpoStatusBar (created by LandingPage)
    in RCTView (created by View)
    in View (created by LandingPage)
    in LandingPage (created by SceneView)
    in StaticContainer
    in EnsureSingleNavigator (created by SceneView)
    in SceneView (created by SceneView)
    in RCTView (created by View)
    in View (created by DebugContainer)
    in DebugContainer (created by MaybeNestedStack)
    in MaybeNestedStack (created by SceneView)
    in RNSScreen (created by AnimatedComponent)
    in AnimatedComponent
    in AnimatedComponentWrapper (created by Screen)
    in MaybeFreeze (created by Screen)
    in Screen (created by SceneView)
    in SceneView (created by NativeStackViewInner)
    in RNSScreenStack (created by ScreenStack)
    in ScreenStack (created by NativeStackViewInner)
    in NativeStackViewInner (created by NativeStackView)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by SafeAreaInsetsContext)
    in SafeAreaProviderCompat (created by NativeStackView)
    in NativeStackView (created by NativeStackNavigator)
    in Unknown (created by NativeStackNavigator)
    in NativeStackNavigator (created by AuthStack)
    in AuthStack (created by Routes)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by Routes)
    in Routes (created by Providers)
    in AuthProvider (created by Providers)
    in Providers (created by App)
    in App (created by ExpoRoot)
    in ExpoRoot
    in RCTView (created by View)
    in View (created by AppContainer)
    in DevAppContainer (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/ReactFiberErrorDialog.js:43:2 in showErrorDialog
at navigation/AuthProvider.js:32:13 in stateChanged
at navigation/AuthProvider.js:31:25 in stateChanged
at node_modules/@firebase/util/dist/index.esm2017.js:1150:0 in <global>
at node_modules/@firebase/util/dist/index.esm2017.js:1312:13 in Sha1#compress_


问:
How can we prevent a funnel chart from bleeding into different levels?
I have a simple dataframe and I'm running this simple code.

```<code>from plotly import graph_objects as go
fig = px.funnel(df, x='MeanDispatchedTime', y='Station_Name', color='MED_Type')
fig.show()
</code>```

Is there some way to get the colors separate and distinct, so the red doesn't bleed into the lower levels? I'm looking at the documentation here.

https://plotly.com/python/funnel-charts/

Or, perhaps, this is completely the wrong chart to be using to tell the story...

Body:
I have a simple dataframe and I'm running this simple code.

from plotly import graph_objects as go
fig = px.funnel(df, x='MeanDispatchedTime', y='Station_Name', color='MED_Type')
fig.show()

Is there some way to get the colors separate and distinct, so the red doesn't bleed into the lower levels? I'm looking at the documentation here.

https://plotly.com/python/funnel-charts/

Or, perhaps, this is completely the wrong chart to be using to tell the story...


问:
Can anyone help me know, if there is any messagebox.anyfunction type of widget in customtkinter?
Can anyone help me know, if there is any messagebox.anyfunction() type of widget in customtkinter.

In customtkinter I tried with customtkinter.CTkInputDialog() but i am trying to implement logic for messagebox.askyesno(), messagebox.askyesnocancel(), etc..

Can anyone help.