问:
How to set broadcast receiver for a scan device which has set keyboard output mode when I actually want to receive the intent output?
I am a new flutter developer for an app which works with scan devices. I have no knowledge when it comes to Kotlin code. We now use the UROVO DT50 Scanner which uses per default the Keyboard output mode. Problem with this mode is that I am receiving the scanned data letter by letter over my keyboard which works but is to slow and not the flow we want to use. Instead you can manually choose the mode Intent Output which we prefer.

However we don't want to set this up manually for every device. Is there a way to configure that in the MainActivity?
-> I want to get the Intent Output even when the scanner is set to keyboard output mode.

This is my current MainActivity file:

```<code>    private val COMMAND_CHANNEL = "com.darryncampbell.datawedgeflutter/command"
    private val SCAN_CHANNEL = "com.darryncampbell.datawedgeflutter/scan"

    private val T50_SCAN_CHANNEL = "T50_SCAN_CHANNEL"

    private val PROFILE_INTENT_ACTION = "com.darryncampbell.datawedgeflutter.SCAN"
    private val PROFILE_INTENT_BROADCAST = "2"

    private val dwInterface = DWInterface()
    private val lucaEvaluator = LucaEvaluator()

    var receiver: BarcodeReceiver? = null

    override
    protected fun onResume() {
        super.onResume()
        receiver?.onResume()
    }

    override
    protected fun onPause() {
        super.onPause()
        receiver?.onPause()
    }

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine)

        setupT50ScanChannel(flutterEngine)

        EventChannel(flutterEngine.dartExecutor, SCAN_CHANNEL).setStreamHandler(
                object : StreamHandler {
                    private var dataWedgeBroadcastReceiver: BroadcastReceiver? = null
                    override fun onListen(arguments: Any?, events: EventSink?) {
                        dataWedgeBroadcastReceiver = createDataWedgeBroadcastReceiver(events)
                        val intentFilter = IntentFilter()
                        intentFilter.addAction(PROFILE_INTENT_ACTION)
                        intentFilter.addAction(DWInterface.DATAWEDGE_RETURN_ACTION)
                        intentFilter.addCategory(DWInterface.DATAWEDGE_RETURN_CATEGORY)
                        registerReceiver(
                                dataWedgeBroadcastReceiver, intentFilter)
                    }

                    override fun onCancel(arguments: Any?) {
                        unregisterReceiver(dataWedgeBroadcastReceiver)
                        dataWedgeBroadcastReceiver = null
                    }
                }
        )

        MethodChannel(flutterEngine.dartExecutor, COMMAND_CHANNEL).setMethodCallHandler { call, result ->
            if (call.method == "sendDataWedgeCommandStringParameter")
            {
                val arguments = JSONObject(call.arguments.toString())
                val command: String = arguments.get("command") as String
                val parameter: String = arguments.get("parameter") as String
                dwInterface.sendCommandString(applicationContext, command, parameter)
                //  result.success(0);  //  DataWedge does not return responses
            }
            else if (call.method == "createDataWedgeProfile")
            {
                createDataWedgeProfile(call.arguments.toString())
            }
            else {
                result.notImplemented()
            }
        }
        MethodChannel(flutterEngine.dartExecutor.binaryMessenger, LUCA_CHANNEL).setMethodCallHandler{
            call, result ->
            when (call.method) {
                "isLucaQRCode" -> {
                    val qrCode = call.argument<String>("qrCode")
                    if(qrCode != null) {
                        result.success(lucaEvaluator.isLucaQRCode(qrCode))
                    }
                }
                "processLucaQRCode" -> {
                    val list = call.arguments<List<String>>()
                    if (list != null) {
                        val qrCode = list[0]
                        val scannerId = list[1]
                        val publicKey = list[2]
                        val locationId = list[3]
                        if(qrCode != null && scannerId != null && publicKey != null && locationId != null) {
                            result.success(lucaEvaluator.processLucaQRCodeToStringOutput(qrCode,scannerId,publicKey,locationId))
                        }
                    }
                }
            }
        }
    }

    private fun createDataWedgeBroadcastReceiver(events: EventSink?): BroadcastReceiver? {
        return object : BroadcastReceiver() {
            override fun onReceive(context: Context, intent: Intent) {
                if (!(intent.action.equals(PROFILE_INTENT_ACTION))) return;
                val scanData = intent.getStringExtra(DWInterface.DATAWEDGE_SCAN_EXTRA_DATA_STRING)
                val symbology = intent.getStringExtra(DWInterface.DATAWEDGE_SCAN_EXTRA_LABEL_TYPE)
                if ((scanData != null) && (symbology != null)) { //  A barcode has been scanned
                    var date = Calendar.getInstance().getTime()
                    var df = SimpleDateFormat("dd/MM/yyyy HH:mm:ss")
                    var dateTimeString = df.format(date)
                    var currentScan = Scan(scanData, symbology, dateTimeString);
                    events?.success(currentScan.toJson())
                }
                //  Could handle return values from DW here such as RETURN_GET_ACTIVE_PROFILE
                //  or RETURN_ENUMERATE_SCANNERS
            }
        }
    }

    private fun createDataWedgeProfile(profileName: String) {
        //  Create and configure the DataWedge profile associated with this application
        //  For readability's sake, I have not defined each of the keys in the DWInterface file
        dwInterface.sendCommandString(this, DWInterface.DATAWEDGE_SEND_CREATE_PROFILE, profileName)
        val profileConfig = Bundle()
        profileConfig.putString("PROFILE_NAME", profileName)
        profileConfig.putString("PROFILE_ENABLED", "true") //  These are all strings
        profileConfig.putString("CONFIG_MODE", "UPDATE")
        val barcodeConfig = Bundle()
        barcodeConfig.putString("PLUGIN_NAME", "BARCODE")
        barcodeConfig.putString("RESET_CONFIG", "true") //  This is the default but never hurts to specify
        val barcodeProps = Bundle()
        barcodeConfig.putBundle("PARAM_LIST", barcodeProps)
        profileConfig.putBundle("PLUGIN_CONFIG", barcodeConfig)
        val appConfig = Bundle()
        appConfig.putString("PACKAGE_NAME", packageName)      //  Associate the profile with this app
        appConfig.putStringArray("ACTIVITY_LIST", arrayOf("*"))
        profileConfig.putParcelableArray("APP_LIST", arrayOf(appConfig))
        dwInterface.sendCommandBundle(this, DWInterface.DATAWEDGE_SEND_SET_CONFIG, profileConfig)
        //  You can only configure one plugin at a time in some versions of DW, now do the intent output
        profileConfig.remove("PLUGIN_CONFIG")
        val intentConfig = Bundle()
        intentConfig.putString("PLUGIN_NAME", "INTENT")
        intentConfig.putString("RESET_CONFIG", "true")
        val intentProps = Bundle()
        intentProps.putString("intent_output_enabled", "true")
        intentProps.putString("intent_action", PROFILE_INTENT_ACTION)
        intentProps.putString("intent_delivery", PROFILE_INTENT_BROADCAST)  //  "2"
        intentConfig.putBundle("PARAM_LIST", intentProps)
        profileConfig.putBundle("PLUGIN_CONFIG", intentConfig)
        dwInterface.sendCommandBundle(this, DWInterface.DATAWEDGE_SEND_SET_CONFIG, profileConfig)
    }

    private fun setupT50ScanChannel(flutterEngine: FlutterEngine) {
        EventChannel(flutterEngine.dartExecutor, T50_SCAN_CHANNEL).setStreamHandler(
            object : StreamHandler {
                override fun onListen(arguments: Any?, events: EventSink?) {
                    Log.d("MainActivity", "Start T50 Listener")
                    receiver = object: BarcodeReceiver(activity) {
                        override fun onNewScanResult(scanResult: String) {
                            Log.d("MainActivity", "New Scan: $scanResult")
                            events?.success(scanResult)
                        }
                    }
                    receiver?.startBarcodeReceiver()
                    receiver?.onResume()
                }

                override fun onCancel(arguments: Any?) {
                    receiver?.onPause()
                }
            }
        )
    }
}
</code>```

Body:
I am a new flutter developer for an app which works with scan devices. I have no knowledge when it comes to Kotlin code. We now use the UROVO DT50 Scanner which uses per default the Keyboard output mode. Problem with this mode is that I am receiving the scanned data letter by letter over my keyboard which works but is to slow and not the flow we want to use. Instead you can manually choose the mode Intent Output which we prefer.

However we don't want to set this up manually for every device. Is there a way to configure that in the MainActivity?
-> I want to get the Intent Output even when the scanner is set to keyboard output mode.

This is my current MainActivity file:

    private val COMMAND_CHANNEL = "com.darryncampbell.datawedgeflutter/command"
    private val SCAN_CHANNEL = "com.darryncampbell.datawedgeflutter/scan"

    private val T50_SCAN_CHANNEL = "T50_SCAN_CHANNEL"

    private val PROFILE_INTENT_ACTION = "com.darryncampbell.datawedgeflutter.SCAN"
    private val PROFILE_INTENT_BROADCAST = "2"

    private val dwInterface = DWInterface()
    private val lucaEvaluator = LucaEvaluator()

    var receiver: BarcodeReceiver? = null

    override
    protected fun onResume() {
        super.onResume()
        receiver?.onResume()
    }

    override
    protected fun onPause() {
        super.onPause()
        receiver?.onPause()
    }

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine)

        setupT50ScanChannel(flutterEngine)

        EventChannel(flutterEngine.dartExecutor, SCAN_CHANNEL).setStreamHandler(
                object : StreamHandler {
                    private var dataWedgeBroadcastReceiver: BroadcastReceiver? = null
                    override fun onListen(arguments: Any?, events: EventSink?) {
                        dataWedgeBroadcastReceiver = createDataWedgeBroadcastReceiver(events)
                        val intentFilter = IntentFilter()
                        intentFilter.addAction(PROFILE_INTENT_ACTION)
                        intentFilter.addAction(DWInterface.DATAWEDGE_RETURN_ACTION)
                        intentFilter.addCategory(DWInterface.DATAWEDGE_RETURN_CATEGORY)
                        registerReceiver(
                                dataWedgeBroadcastReceiver, intentFilter)
                    }

                    override fun onCancel(arguments: Any?) {
                        unregisterReceiver(dataWedgeBroadcastReceiver)
                        dataWedgeBroadcastReceiver = null
                    }
                }
        )

        MethodChannel(flutterEngine.dartExecutor, COMMAND_CHANNEL).setMethodCallHandler { call, result ->
            if (call.method == "sendDataWedgeCommandStringParameter")
            {
                val arguments = JSONObject(call.arguments.toString())
                val command: String = arguments.get("command") as String
                val parameter: String = arguments.get("parameter") as String
                dwInterface.sendCommandString(applicationContext, command, parameter)
                //  result.success(0);  //  DataWedge does not return responses
            }
            else if (call.method == "createDataWedgeProfile")
            {
                createDataWedgeProfile(call.arguments.toString())
            }
            else {
                result.notImplemented()
            }
        }
        MethodChannel(flutterEngine.dartExecutor.binaryMessenger, LUCA_CHANNEL).setMethodCallHandler{
            call, result ->
            when (call.method) {
                "isLucaQRCode" -> {
                    val qrCode = call.argument<String>("qrCode")
                    if(qrCode != null) {
                        result.success(lucaEvaluator.isLucaQRCode(qrCode))
                    }
                }
                "processLucaQRCode" -> {
                    val list = call.arguments<List<String>>()
                    if (list != null) {
                        val qrCode = list[0]
                        val scannerId = list[1]
                        val publicKey = list[2]
                        val locationId = list[3]
                        if(qrCode != null && scannerId != null && publicKey != null && locationId != null) {
                            result.success(lucaEvaluator.processLucaQRCodeToStringOutput(qrCode,scannerId,publicKey,locationId))
                        }
                    }
                }
            }
        }
    }

    private fun createDataWedgeBroadcastReceiver(events: EventSink?): BroadcastReceiver? {
        return object : BroadcastReceiver() {
            override fun onReceive(context: Context, intent: Intent) {
                if (!(intent.action.equals(PROFILE_INTENT_ACTION))) return;
                val scanData = intent.getStringExtra(DWInterface.DATAWEDGE_SCAN_EXTRA_DATA_STRING)
                val symbology = intent.getStringExtra(DWInterface.DATAWEDGE_SCAN_EXTRA_LABEL_TYPE)
                if ((scanData != null) && (symbology != null)) { //  A barcode has been scanned
                    var date = Calendar.getInstance().getTime()
                    var df = SimpleDateFormat("dd/MM/yyyy HH:mm:ss")
                    var dateTimeString = df.format(date)
                    var currentScan = Scan(scanData, symbology, dateTimeString);
                    events?.success(currentScan.toJson())
                }
                //  Could handle return values from DW here such as RETURN_GET_ACTIVE_PROFILE
                //  or RETURN_ENUMERATE_SCANNERS
            }
        }
    }

    private fun createDataWedgeProfile(profileName: String) {
        //  Create and configure the DataWedge profile associated with this application
        //  For readability's sake, I have not defined each of the keys in the DWInterface file
        dwInterface.sendCommandString(this, DWInterface.DATAWEDGE_SEND_CREATE_PROFILE, profileName)
        val profileConfig = Bundle()
        profileConfig.putString("PROFILE_NAME", profileName)
        profileConfig.putString("PROFILE_ENABLED", "true") //  These are all strings
        profileConfig.putString("CONFIG_MODE", "UPDATE")
        val barcodeConfig = Bundle()
        barcodeConfig.putString("PLUGIN_NAME", "BARCODE")
        barcodeConfig.putString("RESET_CONFIG", "true") //  This is the default but never hurts to specify
        val barcodeProps = Bundle()
        barcodeConfig.putBundle("PARAM_LIST", barcodeProps)
        profileConfig.putBundle("PLUGIN_CONFIG", barcodeConfig)
        val appConfig = Bundle()
        appConfig.putString("PACKAGE_NAME", packageName)      //  Associate the profile with this app
        appConfig.putStringArray("ACTIVITY_LIST", arrayOf("*"))
        profileConfig.putParcelableArray("APP_LIST", arrayOf(appConfig))
        dwInterface.sendCommandBundle(this, DWInterface.DATAWEDGE_SEND_SET_CONFIG, profileConfig)
        //  You can only configure one plugin at a time in some versions of DW, now do the intent output
        profileConfig.remove("PLUGIN_CONFIG")
        val intentConfig = Bundle()
        intentConfig.putString("PLUGIN_NAME", "INTENT")
        intentConfig.putString("RESET_CONFIG", "true")
        val intentProps = Bundle()
        intentProps.putString("intent_output_enabled", "true")
        intentProps.putString("intent_action", PROFILE_INTENT_ACTION)
        intentProps.putString("intent_delivery", PROFILE_INTENT_BROADCAST)  //  "2"
        intentConfig.putBundle("PARAM_LIST", intentProps)
        profileConfig.putBundle("PLUGIN_CONFIG", intentConfig)
        dwInterface.sendCommandBundle(this, DWInterface.DATAWEDGE_SEND_SET_CONFIG, profileConfig)
    }

    private fun setupT50ScanChannel(flutterEngine: FlutterEngine) {
        EventChannel(flutterEngine.dartExecutor, T50_SCAN_CHANNEL).setStreamHandler(
            object : StreamHandler {
                override fun onListen(arguments: Any?, events: EventSink?) {
                    Log.d("MainActivity", "Start T50 Listener")
                    receiver = object: BarcodeReceiver(activity) {
                        override fun onNewScanResult(scanResult: String) {
                            Log.d("MainActivity", "New Scan: $scanResult")
                            events?.success(scanResult)
                        }
                    }
                    receiver?.startBarcodeReceiver()
                    receiver?.onResume()
                }

                override fun onCancel(arguments: Any?) {
                    receiver?.onPause()
                }
            }
        )
    }
}


来源: stackexchange

问:
I get bad auth error even though my password is correct
So down below is the snippet I use to connect to my database 'journal'. I placed the password within the string itself. The issue is, that whenever use the URL from the process.env I get the Bad auth err. But if I use the original plain string, it works perfectly. I can perform read, del, write and update operations easily, but if I use the URL from the .env file the connection fails.

require('dotenv').config()

const Port = process.env.port
const url = process.env.DB_conn
//'mongodb+srv://gotham:password@journal.4ok3oge.mongodb.net/journal?retryWrites=true&w=majority'

mongoose.set('strictQuery', false)

try {
    mongoose.connect(url,{
        useNewUrlParser : true
    })
}
catch(err) {
    console.log("connectoin failed")
}
```
<p>And down below is my <code>.env</code> file:</p>
<pre class="lang-js prettyprint-override"><code>DB_conn = 'mongodb+srv://gotham:password@journal.4ok3oge.mongodb.net/journal?retryWrites=true&w=majority'
port = 5000
</code>```

Why does this happen with just the env vars, is anything wrong with the way I access the vars in the .env file?

I have seen different approaches like using options but those were for connecting to a locally hosted database, so I did not go with that approach. Please help me out!

ContentLicense: CC BY-SA 4.0

Body:
So down below is the snippet I use to connect to my database 'journal'. I placed the password within the string itself. The issue is, that whenever use the URL from the process.env I get the Bad auth err. But if I use the original plain string, it works perfectly. I can perform read, del, write and update operations easily, but if I use the URL from the .env file the connection fails.

require('dotenv').config()

const Port = process.env.port
const url = process.env.DB_conn
//'mongodb+srv://gotham:password@journal.4ok3oge.mongodb.net/journal?retryWrites=true&w=majority'

mongoose.set('strictQuery', false)

try {
    mongoose.connect(url,{
        useNewUrlParser : true
    })
}
catch(err) {
    console.log("connectoin failed")
}

And down below is my .env file:

DB_conn = 'mongodb+srv://gotham:password@journal.4ok3oge.mongodb.net/journal?retryWrites=true&w=majority'
port = 5000

Why does this happen with just the env vars, is anything wrong with the way I access the vars in the .env file?

I have seen different approaches like using options but those were for connecting to a locally hosted database, so I did not go with that approach. Please help me out!


问:
Invalid data error during ffmpeg .m4a conversion
I wanted to edit my .m4a voice recording from Samsung Voice Recorder using ffmpeg 2.2.2, however, I got the error Invalid data found when processing input. I tried to open it through Audacity, but it returned an error claiming that the ffmpeg library is missing, which is definitely not the case. Eventually I tried to use online .m4a to .mp3 converters, but they all returned error, so I assume there may be an issue with the encoding of the original file and ffmpeg should be configured accordingly. What settings shall I use? (The original file can be played on the phone without any problem.)

```<code>ffmpeg -ss 00:00:19 -i "C:\Your\Folder\original.m4a" edited.m4a
</code>```

Body:
I wanted to edit my .m4a voice recording from Samsung Voice Recorder using ffmpeg 2.2.2, however, I got the error Invalid data found when processing input. I tried to open it through Audacity, but it returned an error claiming that the ffmpeg library is missing, which is definitely not the case. Eventually I tried to use online .m4a to .mp3 converters, but they all returned error, so I assume there may be an issue with the encoding of the original file and ffmpeg should be configured accordingly. What settings shall I use? (The original file can be played on the phone without any problem.)

ffmpeg -ss 00:00:19 -i "C:\Your\Folder\original.m4a" edited.m4a


问:
gSoap wsdl2h.exe doesn't generate file
I'm trying to create a soap web service client in C using gSoap under Windows server 2022.

I tried to use wsdl2h to convert WSDL file to generate interface header files for soapcpp2, but I obtained an empty file.

When I execute wsdl2h I have this message:

The WSDL file is:

```<code><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:eda-sw-schemas/page/salesorder" targetNamespace="urn:eda-sw-schemas/page/salesorder">
<types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:eda-sw-schemas/page/salesorder">
        <xsd:simpleType name="Job_Queue_Status">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="Scheduled_for_Posting"/>
                <xsd:enumeration value="Error"/>
                <xsd:enumeration value="Posting"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="Status">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="Open"/>
                <xsd:enumeration value="Released"/>
                <xsd:enumeration value="Pending_Approval"/>
                <xsd:enumeration value="Pending_Prepayment"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="Prepmt_CM_Refers_to_Period">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="Current"/>
                <xsd:enumeration value="Current_Calendar_Year"/>
                <xsd:enumeration value="Previous_Calendar_Year"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="Type">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="G_L_Account"/>
                <xsd:enumeration value="Item"/>
                <xsd:enumeration value="Resource"/>
                <xsd:enumeration value="Fixed_Asset"/>
                <xsd:enumeration value="Charge_Item"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="IC_Partner_Ref_Type">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="G_L_Account"/>
                <xsd:enumeration value="Item"/>
                <xsd:enumeration value="Charge_Item"/>
                <xsd:enumeration value="Cross_Reference"/>
                <xsd:enumeration value="Common_Item_No"/>
                <xsd:enumeration value="Vendor_Item_No"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="Prepmt_CM_Refers_to_Period_12139">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="Current"/>
                <xsd:enumeration value="Current_Calendar_Year"/>
                <xsd:enumeration value="Previous_Calendar_Year"/>
            </xsd:restriction>
        </xsd:simpleType>

        <xsd:complexType name="Sales_Order_Line">
            <xsd:sequence>
                <xsd:element minOccurs="0" maxOccurs="1" name="Key" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Type" type="tns:Type"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="FilteredTypeField" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="No" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Include_in_VAT_Transac_Rep" type="xsd:boolean"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="IC_Partner_Ref_Type" type="tns:IC_Partner_Ref_Type"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Prepmt_CM_Refers_to_Period" type="tns:Prepmt_CM_Refers_to_Period_12139"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Requested_Delivery_Date" type="xsd:date"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Whse_Outstanding_Qty" type="xsd:decimal"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Appl_from_Item_Entry" type="xsd:int"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:complexType name="Sales_Order_Line_List">
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="unbounded" name="Sales_Order_Line" type="tns:Sales_Order_Line"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:complexType name="SalesOrder">
            <xsd:sequence>
                <xsd:element minOccurs="0" maxOccurs="1" name="Key" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="No" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Sell_to_Customer_No" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Sell_to_Customer_Name" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Job_Queue_Status" type="tns:Job_Queue_Status"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Status" type="tns:Status"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="SalesLines" type="tns:Sales_Order_Line_List"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:complexType name="SalesOrder_List">
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="unbounded" name="SalesOrder" type="tns:SalesOrder"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:simpleType name="SalesOrder_Fields">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="No"/>
                <xsd:enumeration value="Sell_to_Customer_No"/>
                <xsd:enumeration value="Sell_to_Customer_Name"/>
                <xsd:enumeration value="Job_Queue_Status"/>
                <xsd:enumeration value="Status"/>
            </xsd:restriction>
        </xsd:simpleType>

        <xsd:complexType name="SalesOrder_Filter">
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="1" name="Field" type="tns:SalesOrder_Fields"/>
                <xsd:element minOccurs="1" maxOccurs="1" name="Criteria" type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:element name="ReadMultiple">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element minOccurs="1" maxOccurs="unbounded" name="filter" type="tns:SalesOrder_Filter"/>
                    <xsd:element minOccurs="0" maxOccurs="1" name="bookmarkKey" type="xsd:string"/>
                    <xsd:element minOccurs="1" maxOccurs="1" name="setSize" type="xsd:int"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>

        <xsd:element name="ReadMultiple_Result">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element minOccurs="0" maxOccurs="1" name="ReadMultiple_Result" type="tns:SalesOrder_List"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>

    </xsd:schema>
</types>

<message name="ReadMultiple">
    <part name="parameters" element="tns:ReadMultiple"/>
</message>
<message name="ReadMultiple_Result">
<part name="parameters" element="tns:ReadMultiple_Result"/>
</message>

<portType name="SalesOrder_Port">
    <operation name="ReadMultiple">
        <input name="ReadMultiple" message="tns:ReadMultiple"/>
        <output name="ReadMultiple_Result" message="tns:ReadMultiple_Result"/>
    </operation>
</portType>

<binding name="SalesOrder_Binding" type="tns:SalesOrder_Port">
    <binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>

    <operation name="ReadMultiple">
        <operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:eda-sw-schemas/page/salesorder:ReadMultiple" style="document"/>
        <input name="ReadMultiple">
            <body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
        </input>
        <output name="ReadMultiple_Result">
            <body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
        </output>
    </operation>
</binding>
<service name="SalesOrder_Service">
</code>```

I tried under linux and the .h files are correctly generated.

what I'm doing wrong ?

Title: gSoap wsdl2h.exe doesn't generate file

Body:
I'm trying to create a soap web service client in C using gSoap under Windows server 2022.

I tried to use wsdl2h to convert WSDL file to generate interface header files for soapcpp2, but I obtained an empty file.

When I execute wsdl2h I have this message:

The WSDL file is:

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:eda-sw-schemas/page/salesorder" targetNamespace="urn:eda-sw-schemas/page/salesorder">
<types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:eda-sw-schemas/page/salesorder">
        <xsd:simpleType name="Job_Queue_Status">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="Scheduled_for_Posting"/>
                <xsd:enumeration value="Error"/>
                <xsd:enumeration value="Posting"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="Status">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="Open"/>
                <xsd:enumeration value="Released"/>
                <xsd:enumeration value="Pending_Approval"/>
                <xsd:enumeration value="Pending_Prepayment"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="Prepmt_CM_Refers_to_Period">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="Current"/>
                <xsd:enumeration value="Current_Calendar_Year"/>
                <xsd:enumeration value="Previous_Calendar_Year"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="Type">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="G_L_Account"/>
                <xsd:enumeration value="Item"/>
                <xsd:enumeration value="Resource"/>
                <xsd:enumeration value="Fixed_Asset"/>
                <xsd:enumeration value="Charge_Item"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="IC_Partner_Ref_Type">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="G_L_Account"/>
                <xsd:enumeration value="Item"/>
                <xsd:enumeration value="Charge_Item"/>
                <xsd:enumeration value="Cross_Reference"/>
                <xsd:enumeration value="Common_Item_No"/>
                <xsd:enumeration value="Vendor_Item_No"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="Prepmt_CM_Refers_to_Period_12139">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="_blank_"/>
                <xsd:enumeration value="Current"/>
                <xsd:enumeration value="Current_Calendar_Year"/>
                <xsd:enumeration value="Previous_Calendar_Year"/>
            </xsd:restriction>
        </xsd:simpleType>

        <xsd:complexType name="Sales_Order_Line">
            <xsd:sequence>
                <xsd:element minOccurs="0" maxOccurs="1" name="Key" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Type" type="tns:Type"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="FilteredTypeField" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="No" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Include_in_VAT_Transac_Rep" type="xsd:boolean"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="IC_Partner_Ref_Type" type="tns:IC_Partner_Ref_Type"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Prepmt_CM_Refers_to_Period" type="tns:Prepmt_CM_Refers_to_Period_12139"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Requested_Delivery_Date" type="xsd:date"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Whse_Outstanding_Qty" type="xsd:decimal"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Appl_from_Item_Entry" type="xsd:int"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:complexType name="Sales_Order_Line_List">
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="unbounded" name="Sales_Order_Line" type="tns:Sales_Order_Line"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:complexType name="SalesOrder">
            <xsd:sequence>
                <xsd:element minOccurs="0" maxOccurs="1" name="Key" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="No" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Sell_to_Customer_No" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Sell_to_Customer_Name" type="xsd:string"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Job_Queue_Status" type="tns:Job_Queue_Status"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="Status" type="tns:Status"/>
                <xsd:element minOccurs="0" maxOccurs="1" name="SalesLines" type="tns:Sales_Order_Line_List"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:complexType name="SalesOrder_List">
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="unbounded" name="SalesOrder" type="tns:SalesOrder"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:simpleType name="SalesOrder_Fields">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="No"/>
                <xsd:enumeration value="Sell_to_Customer_No"/>
                <xsd:enumeration value="Sell_to_Customer_Name"/>
                <xsd:enumeration value="Job_Queue_Status"/>
                <xsd:enumeration value="Status"/>
            </xsd:restriction>
        </xsd:simpleType>

        <xsd:complexType name="SalesOrder_Filter">
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="1" name="Field" type="tns:SalesOrder_Fields"/>
                <xsd:element minOccurs="1" maxOccurs="1" name="Criteria" type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>

        <xsd:element name="ReadMultiple">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element minOccurs="1" maxOccurs="unbounded" name="filter" type="tns:SalesOrder_Filter"/>
                    <xsd:element minOccurs="0" maxOccurs="1" name="bookmarkKey" type="xsd:string"/>
                    <xsd:element minOccurs="1" maxOccurs="1" name="setSize" type="xsd:int"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>

        <xsd:element name="ReadMultiple_Result">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element minOccurs="0" maxOccurs="1" name="ReadMultiple_Result" type="tns:SalesOrder_List"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>

    </xsd:schema>
</types>

<message name="ReadMultiple">
    <part name="parameters" element="tns:ReadMultiple"/>
</message>
<message name="ReadMultiple_Result">
<part name="parameters" element="tns:ReadMultiple_Result"/>
</message>

<portType name="SalesOrder_Port">
    <operation name="ReadMultiple">
        <input name="ReadMultiple" message="tns:ReadMultiple"/>
        <output name="ReadMultiple_Result" message="tns:ReadMultiple_Result"/>
    </operation>
</portType>

<binding name="SalesOrder_Binding" type="tns:SalesOrder_Port">
    <binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>

    <operation name="ReadMultiple">
        <operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:eda-sw-schemas/page/salesorder:ReadMultiple" style="document"/>
        <input name="ReadMultiple">

        </input>
        <output name="ReadMultiple_Result">

        </output>
    </operation>
</binding>
<service name="SalesOrder_Service">

I tried under linux and the .h files are correctly generated.

what I'm doing wrong ?


问:
rmarkdown: how to display & number only the current tab in TOC
I have three questions regarding a markdown document (rendered as html) with several tabs using {.tabset} and a numbered table of contents. The tabs are relatively big chapters.

A. The biggest problem is that the toc shows the content of all tabs, whereas I would like the toc to only display the current tab and hide the tabs which are currently blended out. It seems that I´m not the only one looking for such a solution: Rmarkdown toc for tabbed content (only showing corresponding headings) or Rmarkdown : is it possible to display the TOC of the current tab only in a tabset - but the solutions seem to not work anymore, also for other users.

(I unfortunately can´t comment any of those, hence asking separately)

B. Furthermore, when using a numbered toc, the numbering keeps on going from tab A to tab B and only then to the rest of the document, e.g.:

1.1 = preface

1.2 = workflow in tab A

1.3 = workflow in tab B

1.4 = resources

--> whereas the numbering should ignore the tab which is currently blended out (i.e. 1.3 = resources no matter which tab is on) - is there a possibility of doing it?

C. One last question is about numbered sections using tabset: {.tabset} requires using two section levels: one # for the selection section and a second level ## for each tab:

```<code># Project Type {#Type .tabset .tabset-fade .unnumbered}

## Type A

`r preface`

`r Project_workflow_A`

## Type B

`r preface`

`r Project_workflow_B`

</code>```

--> consequently, when using numbered sections within the tabs, those sections would have to be at least at level three ###, even though they should basically be level one or two --> any ideas for workarounds? (besides using different documents instead of tabs?)

I tried playing around quite a lot with the arguments and googling, but I believe I´m missing out on something essential. Any ideas for working directions would be welcome!

Thanks a lot in advance!

Body:
I have three questions regarding a markdown document (rendered as html) with several tabs using {.tabset} and a numbered table of contents. The tabs are relatively big chapters.

A. The biggest problem is that the toc shows the content of all tabs, whereas I would like the toc to only display the current tab and hide the tabs which are currently blended out. It seems that I´m not the only one looking for such a solution: Rmarkdown toc for tabbed content (only showing corresponding headings) or Rmarkdown : is it possible to display the TOC of the current tab only in a tabset - but the solutions seem to not work anymore, also for other users.

(I unfortunately can´t comment any of those, hence asking separately)

B. Furthermore, when using a numbered toc, the numbering keeps on going from tab A to tab B and only then to the rest of the document, e.g.:

1.1 = preface

1.2 = workflow in tab A

1.3 = workflow in tab B

1.4 = resources

--> whereas the numbering should ignore the tab which is currently blended out (i.e. 1.3 = resources no matter which tab is on) - is there a possibility of doing it?

C. One last question is about numbered sections using tabset: {.tabset} requires using two section levels: one # for the selection section and a second level ## for each tab:

# Project Type {#Type .tabset .tabset-fade .unnumbered}

## Type A

`r preface`

`r Project_workflow_A`

## Type B

`r preface`

`r Project_workflow_B`

--> consequently, when using numbered sections within the tabs, those sections would have to be at least at level three ###, even though they should basically be level one or two --> any ideas for workarounds? (besides using different documents instead of tabs?)

I tried playing around quite a lot with the arguments and googling, but I believe I´m missing out on something essential. Any ideas for working directions would be welcome!

Thanks a lot in advance!


问:
Why does VSCode reopen windows the way it wants and not the way they were the last time I closed it?
I cannot find an answer/solution to this issue.

Every time I reopen VS Code after a work session (or after turning the PC off and on again) the windows that open at the same time (because they were open at the same time before I closed VSCode) are sometimes full screen, other times they are reduced to the center of the screen, but this doesn't seem to have a precise pattern and above all I can't find settings that allow me to always open them all maximized (as they were when I closed VSCode last time).

How can this be solved?


问:
Android Studio icon is missing when I install my app
I have developed an app everything was working ok but when I sent to Google Play Store and I tried to install the app from store, the icon doesn't show in the screen. Now when I run it from emulator the icon doesn't show again.

This is the manifest file

```<code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<application
    android:allowBackup="true"
    android:dataExtractionRules="@xml/data_extraction_rules"
    android:fullBackupContent="@xml/backup_rules"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.myAppName"
    tools:targetApi="31">
    <activity
        android:theme="@style/Theme.AppCompat.NoActionBar"
        android:name=".luces"
        android:exported="true">

        <meta-data
            android:name="android.app.lib_name"
            android:value="" />
    </activity>
    <activity
        android:theme="@style/Theme.AppCompat.NoActionBar"
        android:name=".MainActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <meta-data
            android:name="android.app.lib_name"
            android:value="" />
    </activity>
</application>
</code>```

I tried to reupload the icon using File > New Image Asset but it didn't worked

Body:
I have developed an app everything was working ok but when I sent to Google Play Store and I tried to install the app from store, the icon doesn't show in the screen. Now when I run it from emulator the icon doesn't show again.

This is the manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<application
    android:allowBackup="true"
    android:dataExtractionRules="@xml/data_extraction_rules"
    android:fullBackupContent="@xml/backup_rules"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.myAppName"
    tools:targetApi="31">
    <activity
        android:theme="@style/Theme.AppCompat.NoActionBar"
        android:name=".luces"
        android:exported="true">

        <meta-data
            android:name="android.app.lib_name"
            android:value="" />
    </activity>
    <activity
        android:theme="@style/Theme.AppCompat.NoActionBar"
        android:name=".MainActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <meta-data
            android:name="android.app.lib_name"
            android:value="" />
    </activity>
</application>

I tried to reupload the icon using File > New Image Asset but it didn't worked


问:
Intellij IDEA problems auto complete
I have a problem when I code with Intellij IDEA and I write for example "path" and I put the "=" automatically it puts me that "{}" just after the equal. Is there any way to disable this?

screenshot of the problem

I have searched in the settings of Intellij IDEA but I did not find anything

Title: Intellij IDEA problems auto complete


问:
Giphy-API not giving any results for normal users?
I'm trying to get the latest 100 posts from my giphy user.

It works for accounts like "giphy" and "spongebob"
But not for "jack0_o"

```<code>import requests

def get_user_gifs(username):
    api_key = "API_KEY"
    limit = 25  # The number of GIFs to retrieve per request (max 25)
    offset = 0

    # Set a flag to indicate when all GIFs have been retrieved
    done = False

    # Keep making requests until all GIFs have been retrieved
    while not done:
        # Make the request to the Giphy API
        endpoint = f"https://api.giphy.com/v1/gifs/search?api_key={api_key}&q={username}&limit={limit}&offset={offset}&sort=recent"
        response = requests.get(endpoint)
        data = response.json()

        # Extract the GIF URLs from the data and print them one per line
        for gif in data["data"]:
            print(gif["url"])

        # Update the starting index for the next batch of GIFs
        offset += limit

        # Check if there are more GIFs to retrieve
        if len(data["data"]) < limit or offset >= 100:
            done = True

</code>```
```<code>get_user_gifs("spongebob") #WORKS
get_user_gifs("jack0_o")  #does not work
</code>```

Already tried adding ratings with "pg", "r", "g"

Body:
I'm trying to get the latest 100 posts from my giphy user.

It works for accounts like "giphy" and "spongebob"
But not for "jack0_o"

import requests

def get_user_gifs(username):
    api_key = "API_KEY"
    limit = 25  # The number of GIFs to retrieve per request (max 25)
    offset = 0

    # Set a flag to indicate when all GIFs have been retrieved
    done = False

    # Keep making requests until all GIFs have been retrieved
    while not done:
        # Make the request to the Giphy API
        endpoint = f"https://api.giphy.com/v1/gifs/search?api_key={api_key}&q={username}&limit={limit}&offset={offset}&sort=recent"
        response = requests.get(endpoint)
        data = response.json()

        # Extract the GIF URLs from the data and print them one per line
        for gif in data["data"]:
            print(gif["url"])

        # Update the starting index for the next batch of GIFs
        offset += limit

        # Check if there are more GIFs to retrieve
        if len(data["data"]) < limit or offset >= 100:
            done = True

get_user_gifs("spongebob") #WORKS
get_user_gifs("jack0_o")  #does not work

Already tried adding ratings with "pg", "r", "g"


问:
Material DatePicker Not Showing Properly
The Date Picker is not coming as Expected can any one help me on how to remove this issues?

```<code> var datePickerBuilder = MaterialDatePicker.Builder.datePicker()
                datePickerBuilder.setTitleText("Select Date")
                datePickerBuilder.setTheme(R.style.DatePickerTheme)
                var materialDatePicker = datePickerBuilder.build()
                materialDatePicker.show(requireActivity().supportFragmentManager,"DATE_PICKER")
</code>```

above code is for datePickerDailog

and here are the stylings -

```<code> <style name="DatePickerTheme" parent="Theme.MaterialComponents.DayNight">
        <item name="materialCalendarFullscreenTheme">@style/CustomThemeOverlay_MaterialCalendar_Fullscreen</item>
    </style>

    <style name="CustomThemeOverlay_MaterialCalendar_Fullscreen"
        parent="@style/ThemeOverlay.MaterialComponents.MaterialCalendar.Fullscreen">
        <item name="materialCalendarStyle">@style/Custom_MaterialCalendar.Fullscreen</item>
    </style>

    <style name="Custom_MaterialCalendar.Fullscreen"
        parent="@style/Widget.MaterialComponents.MaterialCalendar.Fullscreen">
        <item name="android:windowFullscreen">true</item>
</code>```

image -

im trying to expect someThing like this -

Body:
The Date Picker is not coming as Expected can any one help me on how to remove this issues?

 var datePickerBuilder = MaterialDatePicker.Builder.datePicker()
                datePickerBuilder.setTitleText("Select Date")
                datePickerBuilder.setTheme(R.style.DatePickerTheme)
                var materialDatePicker = datePickerBuilder.build()
                materialDatePicker.show(requireActivity().supportFragmentManager,"DATE_PICKER")

above code is for datePickerDailog

and here are the stylings -


问:
How to find out superclass in an annotation processor?
I'm building an annotation processor. How can I find out the superclass of an annotated class?

```<code>@Retention(SOURCE)
@Target({ METHOD, TYPE })
public @interface Auditable {
}

class A {
    @Auditable
    Integer getInt() { ... }
}

@Auditable
class B extends A { ... }
</code>```

Annotation processor provides two annotated elements. One for method getInt in class A and one for class B.

How can I find out that B extends A?

Partial code of the annotation processor:

```<code>private void process( Set<? extends TypeElement> annotations,
        RoundEnvironment roundEnv ) {
    Set<? extends Element> annotatedElements =
            roundEnv.getElementsAnnotatedWith( Auditable.class );
    for ( Element element : annotatedElements ) {
        ElementKind kind = element.getKind();
        if ( ElementKind.CLASS.equals( kind ) ) {
            // --- here I need to find out superclass ---
        } else if ( ElementKind.METHOD.equals( kind ) ) {
            workOnMethod( (ExecutableElement) element );
        } else {
            processingEnv.getMessager().printMessage( Kind.WARNING,
                String.format( "WARNING: @Auditable must be applied "
                "to a JPA entity or method but found at %s", element.toString()));
        }}}
</code>```

Body:
I'm building an annotation processor. How can I find out the superclass of an annotated class?

@Retention(SOURCE)
@Target({ METHOD, TYPE })
public @interface Auditable {
}

class A {
    @Auditable
    Integer getInt() { ... }
}

@Auditable
class B extends A { ... }

Annotation processor provides two annotated elements. One for method getInt in class A and one for class B.

How can I find out that B extends A?

Partial code of the annotation processor:

private void process( Set<? extends TypeElement> annotations,
        RoundEnvironment roundEnv ) {
    Set<? extends Element> annotatedElements =
            roundEnv.getElementsAnnotatedWith( Auditable.class );
    for ( Element element : annotatedElements ) {
        ElementKind kind = element.getKind();
        if ( ElementKind.CLASS.equals( kind ) ) {
            // --- here I need to find out superclass ---
        } else if ( ElementKind.METHOD.equals( kind ) ) {
            workOnMethod( (ExecutableElement) element );
        } else {
            processingEnv.getMessager().printMessage( Kind.WARNING,
                String.format( "WARNING: @Auditable must be applied "
                "to a JPA entity or method but found at %s", element.toString()));
        }}}


问:
VMTRACER and Memory
i try to delete Dirty Memory and u se VMTRACE but i dont know why this code have dirty memory     </p>

```<code>NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Info.plist"];
    NSDictionary *dict =[[[NSDictionary alloc] initWithContentsOfFile:path] autorelease];
</code>```

ContentLicense: CC BY-SA 3.0

Title: VMTRACER and Memory

Body:
i try to delete Dirty Memory and u se VMTRACE but i dont know why this code have dirty memory

NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Info.plist"];
    NSDictionary *dict =[[[NSDictionary alloc] initWithContentsOfFile:path] autorelease];


问:
ValueError: Input arrays must be multi-channel 2D images
I am trying to do a deep learning model using Keras and VGG16 algorithm on DICOM images.
I used thhe following data generator to process my images:

```<code>``
 # tested on tf 2.1
 from keras_preprocessing.image.dataframe_iterator import DataFrameIterator

 class DCMDataFrameIterator(DataFrameIterator):
     def __init__(self, *arg, **kwargs):
        self.white_list_formats = ('dcm')
        super(DCMDataFrameIterator, self).__init__(*arg, **kwargs)
        self.dataframe = kwargs['dataframe']
        self.x = self.dataframe[kwargs['x_col']]
        self.y = self.dataframe[kwargs['y_col']]
        self.color_mode = kwargs['color_mode']
        self.target_size = kwargs['target_size']

def _get_batches_of_transformed_samples(self, indices_array):
    # get batch of images
    batch_x = np.array([self.read_dcm_as_array(dcm_path, self.target_size, color_mode=self.color_mode)
                        for dcm_path in self.x.iloc[indices_array]])

    batch_y = np.array(self.y.iloc[indices_array].astype(np.uint8))  # astype because y was passed as str

    # transform images
    if self.image_data_generator is not None:
        for i, (x, y) in enumerate(zip(batch_x, batch_y)):
            transform_params = self.image_data_generator.get_random_transform(x.shape)
            batch_x[i] = self.image_data_generator.apply_transform(x, transform_params)
            # you can change y here as well, eg: in semantic segmentation you want to transform masks as well
            # using the same image_data_generator transformations.

    return batch_x, batch_y

@staticmethod

def read_dcm_as_array(dcm_path, target_size=(256, 256), color_mode='rgb'):
    img = tf.io.read_file(dcm_path)
    img = tfio.image.decode_dicom_image(img, dtype=tf.uint16)
    img = tf.image.resize(img, target_size)
    img = tf.image.grayscale_to_rgb(img, name=None) # convert image grayscale to rgb for model VG16
    #img = np.expand_dims(img, -1)
    return img
``
</code>```

and:
``
# you can use preprocessing_function instead of rescale in all generators
# if you are using a pretrained network
train_augmentation_parameters = dict(
rescale=1.0/255.0,
rotation_range=10,
zoom_range=0.2,
horizontal_flip=True,
fill_mode='nearest',
brightness_range = [0.8, 1.2],
validation_split = 0.2
)

```<code> valid_augmentation_parameters = dict(
rescale=1.0/255.0,
validation_split = 0.2
</code>```

)

```<code>test_augmentation_parameters = dict(
rescale=1.0/255.0
</code>```

)

```<code># training parameters
BATCH_SIZE = 32
CLASS_MODE = 'sparse'
COLOR_MODE = 'grayscale'
TARGET_SIZE = (300, 300)
EPOCHS = 10
SEED = 1337

train_consts = {
'seed': SEED,
'batch_size': BATCH_SIZE,
'class_mode': CLASS_MODE,
'color_mode': COLOR_MODE,
'target_size': TARGET_SIZE,
'subset': 'training'
</code>```

}

```<code> valid_consts = {
'seed': SEED,
'batch_size': BATCH_SIZE,
'class_mode': CLASS_MODE,
'color_mode': COLOR_MODE,
'target_size': TARGET_SIZE,
'subset': 'validation'
</code>```

}

```<code>test_consts = {
'batch_size': 1,  # should be 1 in testing
'class_mode': CLASS_MODE,
'color_mode': COLOR_MODE,
'target_size': TARGET_SIZE,  # resize input images
'shuffle': False
</code>```

}
``

and:

```<code>``
# Using the training phase generators
 train_augmenter = ImageDataGenerator(**train_augmentation_parameters)
 valid_augmenter = ImageDataGenerator(**valid_augmentation_parameters)

 train_generator = DCMDataFrameIterator(dataframe=df_merged,
                         x_col='files',
                         y_col='class',
                         image_data_generator=train_augmenter,
                         **train_consts)

 valid_generator = DCMDataFrameIterator(dataframe=df_merged,
                         x_col='files',
                         y_col='class',
                         image_data_generator=valid_augmenter,
                         **valid_consts)
``
</code>```

Result of last command:

```<code>``
 Found 7828 validated image filenames belonging to 4 classes.
 Found 1956 validated image filenames belonging to 4 classes.
``
</code>```

After:

```<code> ``
base_model = VGG16(weights='imagenet', include_top=False)

n_class = 4 #

# Freezer les couches du VGG16
for layer in base_model.layers:
    layer.trainable = False

model = Sequential()
model.add(base_model) # Ajout du modèle VGG16
model.add(GlobalAveragePooling2D())
model.add(Dense(1024,activation='relu'))
model.add(Dropout(rate=0.2))
model.add(Dense(512, activation='relu'))
model.add(Dropout(rate=0.2))
model.add(Dense(n_class, activation='softmax'))
``
</code>```

I compile but but when I do .fit I have the following message:

ValueError: Input arrays must be multi-channel 2D images.

Could you help me ?
Thank you in advance,
Thibaut

I had a look on stackoverflow to try to find a solution !

Body:
I am trying to do a deep learning model using Keras and VGG16 algorithm on DICOM images.
I used thhe following data generator to process my images:

``
 # tested on tf 2.1
 from keras_preprocessing.image.dataframe_iterator import DataFrameIterator

 class DCMDataFrameIterator(DataFrameIterator):
     def __init__(self, *arg, **kwargs):
        self.white_list_formats = ('dcm')
        super(DCMDataFrameIterator, self).__init__(*arg, **kwargs)
        self.dataframe = kwargs['dataframe']
        self.x = self.dataframe[kwargs['x_col']]
        self.y = self.dataframe[kwargs['y_col']]
        self.color_mode = kwargs['color_mode']
        self.target_size = kwargs['target_size']

def _get_batches_of_transformed_samples(self, indices_array):
    # get batch of images
    batch_x = np.array([self.read_dcm_as_array(dcm_path, self.target_size, color_mode=self.color_mode)
                        for dcm_path in self.x.iloc[indices_array]])

    batch_y = np.array(self.y.iloc[indices_array].astype(np.uint8))  # astype because y was passed as str

    # transform images
    if self.image_data_generator is not None:
        for i, (x, y) in enumerate(zip(batch_x, batch_y)):
            transform_params = self.image_data_generator.get_random_transform(x.shape)
            batch_x[i] = self.image_data_generator.apply_transform(x, transform_params)
            # you can change y here as well, eg: in semantic segmentation you want to transform masks as well
            # using the same image_data_generator transformations.

    return batch_x, batch_y

@staticmethod

def read_dcm_as_array(dcm_path, target_size=(256, 256), color_mode='rgb'):
    img = tf.io.read_file(dcm_path)
    img = tfio.image.decode_dicom_image(img, dtype=tf.uint16)
    img = tf.image.resize(img, target_size)
    img = tf.image.grayscale_to_rgb(img, name=None) # convert image grayscale to rgb for model VG16
    #img = np.expand_dims(img, -1)
    return img
``

and:
``
# you can use preprocessing_function instead of rescale in all generators
# if you are using a pretrained network
train_augmentation_parameters = dict(
rescale=1.0/255.0,
rotation_range=10,
zoom_range=0.2,
horizontal_flip=True,
fill_mode='nearest',
brightness_range = [0.8, 1.2],
validation_split = 0.2
)

 valid_augmentation_parameters = dict(
rescale=1.0/255.0,
validation_split = 0.2

)

test_augmentation_parameters = dict(
rescale=1.0/255.0

)

# training parameters
BATCH_SIZE = 32
CLASS_MODE = 'sparse'
COLOR_MODE = 'grayscale'
TARGET_SIZE = (300, 300)
EPOCHS = 10
SEED = 1337

train_consts = {
'seed': SEED,
'batch_size': BATCH_SIZE,
'class_mode': CLASS_MODE,
'color_mode': COLOR_MODE,
'target_size': TARGET_SIZE,
'subset': 'training'

}

 valid_consts = {
'seed': SEED,
'batch_size': BATCH_SIZE,
'class_mode': CLASS_MODE,
'color_mode': COLOR_MODE,
'target_size': TARGET_SIZE,
'subset': 'validation'

}

test_consts = {
'batch_size': 1,  # should be 1 in testing
'class_mode': CLASS_MODE,
'color_mode': COLOR_MODE,
'target_size': TARGET_SIZE,  # resize input images
'shuffle': False

}
``

and:

``
# Using the training phase generators
 train_augmenter = ImageDataGenerator(**train_augmentation_parameters)
 valid_augmenter = ImageDataGenerator(**valid_augmentation_parameters)

 train_generator = DCMDataFrameIterator(dataframe=df_merged,
                         x_col='files',
                         y_col='class',
                         image_data_generator=train_augmenter,
                         **train_consts)

 valid_generator = DCMDataFrameIterator(dataframe=df_merged,
                         x_col='files',
                         y_col='class',
                         image_data_generator=valid_augmenter,
                         **valid_consts)
``

Result of last command:

``
 Found 7828 validated image filenames belonging to 4 classes.
 Found 1956 validated image filenames belonging to 4 classes.
``

After:

 ``
base_model = VGG16(weights='imagenet', include_top=False)

n_class = 4 #

# Freezer les couches du VGG16
for layer in base_model.layers:
    layer.trainable = False

model = Sequential()
model.add(base_model) # Ajout du modèle VGG16
model.add(GlobalAveragePooling2D())
model.add(Dense(1024,activation='relu'))
model.add(Dropout(rate=0.2))
model.add(Dense(512, activation='relu'))
model.add(Dropout(rate=0.2))
model.add(Dense(n_class, activation='softmax'))
``

I compile but but when I do .fit I have the following message:

ValueError: Input arrays must be multi-channel 2D images.

Could you help me ?
Thank you in advance,
Thibaut

I had a look on stackoverflow to try to find a solution !


问:
Is there is a proper way to access specific external entities after restrict by accessExternalSchema?
I received a sonar error stating that "Disable access to external entities in XML parsing" so I used the code below.

```<code>SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
      factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
      factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
</code>```

The sonar problem is then resolved, but I need to access a specific external file afterwards. Is there a correct way to access that specific file?

I looked to see if there were any parameters for setProperty() that could achieve this, but I couldn't find one..

Body:
I received a sonar error stating that "Disable access to external entities in XML parsing" so I used the code below.

SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
      factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
      factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");

The sonar problem is then resolved, but I need to access a specific external file afterwards. Is there a correct way to access that specific file?

I looked to see if there were any parameters for setProperty() that could achieve this, but I couldn't find one..


问:
Get token from URL and send it with res.sendfile
I'm trying to make an email verification for my node.js site and to know what user is getting verified I added the user token in the URL. I need to get the token out of the URL with req.query.token and then send it to the file where its used from the pages file with all the router.get functions.

By what I tried the code receives the token from the URL http://localhost:5000/verify-email?token=t73kQzE6ItQIa9eQHqDs here:

```<code>router.get("/verify-email", (req,res) => {
    var token = req.query.token
    console.log(token)
    res.sendFile(path.join(__dirname, '../public', 'emailverification.html'),token)
})
</code>```

then it goes to the html page which sends it to the next .js file:

```<code>window.addEventListener("load",() => {
    fetch("/api/emailverification", {
        method: "POST",
        //body: JSON.stringify(token),
        headers: {
            "Content-Type":"application/json"
        }
    }).then(res => res.json())
        //console.log(res.json())
        .then(data  => {
            if(data.status == "error") {
                success.style.display = "none"
                error.style.display = "block"
                alertmsg.style.display = "none"
                error.innerText = data.error
            } else if (data.status == "success")  {
                error.style.display = "none"
                success.style.display = "block"
                alertmsg.style.display = "none"
                success.innerText = data.success
            } else {
                error.style.display = "none"
                success.style.display = "none"
                alertmsg.style.display = "block"
                alertmsg.innerText = data.alertmsg
            }
        })
})
</code>```

which then sends it to the last file:

```<code>const db = require("../routes/db-config");

const emailverification = async (req,res,next) => {
    const token = req.token
    db.query('SELECT * FROM users WHERE token = ?',[token], async(err, result) =>{
        if (err) throw err;
        console.log(result)
        if(result[0].verify == 0){
            if (result.length > 0) {
                var data = {
                    verify: 1
                }
                db.query('UPDATE users SET ? WHERE email = ?', [result[0].email], data,(err, result) => {
                    console.log('hello2')
                    if(err) throw err

                })
                return res.json({ status: 'success', success: "account created successfully" })

            } else {
                return res.json({ status: 'error', error: "email already verified" })
            }
         }else{
            console.log(result)
            return res.json({ status: 'error', error: "email already verified" })
         }
    })
}
module.exports = emailverification;
</code>```

which should send an error or success message back to show on the site.
I use this many files to try and keep my code tidy and organized which works for me

Body:
I'm trying to make an email verification for my node.js site and to know what user is getting verified I added the user token in the URL. I need to get the token out of the URL with req.query.token and then send it to the file where its used from the pages file with all the router.get functions.

By what I tried the code receives the token from the URL http://localhost:5000/verify-email?token=t73kQzE6ItQIa9eQHqDs here:

router.get("/verify-email", (req,res) => {
    var token = req.query.token
    console.log(token)
    res.sendFile(path.join(__dirname, '../public', 'emailverification.html'),token)
})

then it goes to the html page which sends it to the next .js file:

window.addEventListener("load",() => {
    fetch("/api/emailverification", {
        method: "POST",
        //body: JSON.stringify(token),
        headers: {
            "Content-Type":"application/json"
        }
    }).then(res => res.json())
        //console.log(res.json())
        .then(data  => {
            if(data.status == "error") {
                success.style.display = "none"
                error.style.display = "block"
                alertmsg.style.display = "none"
                error.innerText = data.error
            } else if (data.status == "success")  {
                error.style.display = "none"
                success.style.display = "block"
                alertmsg.style.display = "none"
                success.innerText = data.success
            } else {
                error.style.display = "none"
                success.style.display = "none"
                alertmsg.style.display = "block"
                alertmsg.innerText = data.alertmsg
            }
        })
})

which then sends it to the last file:

const db = require("../routes/db-config");

const emailverification = async (req,res,next) => {
    const token = req.token
    db.query('SELECT * FROM users WHERE token = ?',[token], async(err, result) =>{
        if (err) throw err;
        console.log(result)
        if(result[0].verify == 0){
            if (result.length > 0) {
                var data = {
                    verify: 1
                }
                db.query('UPDATE users SET ? WHERE email = ?', [result[0].email], data,(err, result) => {
                    console.log('hello2')
                    if(err) throw err

                })
                return res.json({ status: 'success', success: "account created successfully" })

            } else {
                return res.json({ status: 'error', error: "email already verified" })
            }
         }else{
            console.log(result)
            return res.json({ status: 'error', error: "email already verified" })
         }
    })
}
module.exports = emailverification;

which should send an error or success message back to show on the site.
I use this many files to try and keep my code tidy and organized which works for me


问:
Easyadmin issues a lot of querys when filtering and the CRUD class has the @UniqueEntity constraint
I have a problem when filtering at the index page of a CRUD.

The CRUD class is Product, if a filter by an association (Brand in my case), a lot of queries are issued if the Product class has the @UniqueEntity constraint.

To Reproduce

Product entity class with the constraint on top and its related brand entity

```<code>...
 * @UniqueEntity(fields={"name"})
 */
class Product
{
    /**
     * @ORM\ManyToOne(targetEntity=Brand::class, inversedBy="products")
     * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
     */
    private $brand;
</code>```

Brand class has the inverse side defined too:

```<code>    /**
     * @ORM\OneToMany(targetEntity=Product::class, mappedBy="brand", cascade={"persist"})
     */
    private $products;
</code>```

I have a CRUD controller for the Product entity.

I added an EntityFilter for brands in the filters section:

```<code>  public function configureFilters(Filters $filters): Filters
  {
      return $filters
          ->add(EntityFilter::new('brand', 'Brand'));
  }

</code>```

When i enter a brand in the filter popup and apply, a lot of querys are issued. It is like it is trying to revalidate that the name is unique for each filtered product. Querys are like this (one for each filtered product):

SELECT ... FROM product t0 WHERE t0.name = 'similique culpa non rerum rem in assumenda' LIMIT 2;

"similique culpa non rerum rem in assumenda" being the name of one of the filtered products.

If i remove the @UniqueEntity(fields={"name"}) constraint, the queries are not issued.

Version of Easy Admin bundle is 4.0

Thanks a lot!

UPDATE: Well i think the problem comes when you have the inverse side of the relation defined too. In my example, if i define the OneToMany "brand.products" inverse side of the relation, then, filtering by a brand issues the queries (i guess it is a matter of how the filter form, on the handleRequest call, recursively finds and validates constraints). If i remove the inverse side of the relation in Brand, no queries are issued.

In small applications this maybe no problem but, in my case, i have brands with thousands of products and, if i filter by such brands, a query is issued for each product, so that's no minor problem.

Body:
I have a problem when filtering at the index page of a CRUD.

The CRUD class is Product, if a filter by an association (Brand in my case), a lot of queries are issued if the Product class has the @UniqueEntity constraint.

To Reproduce

Product entity class with the constraint on top and its related brand entity

...
 * @UniqueEntity(fields={"name"})
 */
class Product
{
    /**
     * @ORM\ManyToOne(targetEntity=Brand::class, inversedBy="products")
     * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
     */
    private $brand;

Brand class has the inverse side defined too:

    /**
     * @ORM\OneToMany(targetEntity=Product::class, mappedBy="brand", cascade={"persist"})
     */
    private $products;

I have a CRUD controller for the Product entity.

I added an EntityFilter for brands in the filters section:

  public function configureFilters(Filters $filters): Filters
  {
      return $filters
          ->add(EntityFilter::new('brand', 'Brand'));
  }

When i enter a brand in the filter popup and apply, a lot of querys are issued. It is like it is trying to revalidate that the name is unique for each filtered product. Querys are like this (one for each filtered product):

SELECT ... FROM product t0 WHERE t0.name = 'similique culpa non rerum rem in assumenda' LIMIT 2;

"similique culpa non rerum rem in assumenda" being the name of one of the filtered products.

If i remove the @UniqueEntity(fields={"name"}) constraint, the queries are not issued.

Version of Easy Admin bundle is 4.0

Thanks a lot!

UPDATE: Well i think the problem comes when you have the inverse side of the relation defined too. In my example, if i define the OneToMany "brand.products" inverse side of the relation, then, filtering by a brand issues the queries (i guess it is a matter of how the filter form, on the handleRequest call, recursively finds and validates constraints). If i remove the inverse side of the relation in Brand, no queries are issued.

In small applications this maybe no problem but, in my case, i have brands with thousands of products and, if i filter by such brands, a query is issued for each product, so that's no minor problem.


问:
Parallel requests within the same transaction
I would like to execute several SQL statements in parallel and within the same transaction in order to get work around a high latency to the database server (SQL Server).

From my research, it seems like R2DBC would be my best bet for accomplishing this. However, when I experiment it seems like:

All statements that are to execute within the same transaction must go via the same connection object.

All statements using the same connection object are serially executed.

Is this true? It makes perfect sense that the database server would force statements within the same transaction to execute serially, but I would have imagined that this serialization would take place on the server side and that the driver would have allowed several in flights requests at the same time.

If this is not true I would like some help figuring out what I am doing wrong. This is how I have set up my connection pool:

```<code>return new MssqlConnectionFactory(MssqlConnectionConfiguration.builder()
                .host("localhost")
                .port(port)
                .database(db)
                .username(user)
                .password(password)
                .build());
</code>```

And this is my test code:

```<code>var connection = pool.create().block();
Mono.from(connection.setAutoCommit(false)).block();
Scheduler scheduler = Schedulers.newParallel("foo",  10);
for (int i = 0; i < 10; i++) {
    final int j = i;
    Mono.just(connection)
        .subscribeOn(scheduler)
        .flatMap(conn -> Mono.from(conn.createStatement("select " + j).execute()))
        .flatMap(result -> Mono.from(result.map((row, meta) -> row.get(0, Integer.class))))
        .doOnNext(System.out::println)
        .subscribe();
}
</code>```

Depending on the parallelism value of the scheduler I may get an error that the request queue is full. If I fetch a new connection object for every request instead of reusing the same one everything executes in parallel but as far as I can tell there's no way to get them to execute within the same transaction then.

I am using toxiproxy to simulate extra latency to the sql server instance.

Body:
I would like to execute several SQL statements in parallel and within the same transaction in order to get work around a high latency to the database server (SQL Server).

From my research, it seems like R2DBC would be my best bet for accomplishing this. However, when I experiment it seems like:

All statements that are to execute within the same transaction must go via the same connection object.

All statements using the same connection object are serially executed.

Is this true? It makes perfect sense that the database server would force statements within the same transaction to execute serially, but I would have imagined that this serialization would take place on the server side and that the driver would have allowed several in flights requests at the same time.

If this is not true I would like some help figuring out what I am doing wrong. This is how I have set up my connection pool:

return new MssqlConnectionFactory(MssqlConnectionConfiguration.builder()
                .host("localhost")
                .port(port)
                .database(db)
                .username(user)
                .password(password)
                .build());

And this is my test code:

var connection = pool.create().block();
Mono.from(connection.setAutoCommit(false)).block();
Scheduler scheduler = Schedulers.newParallel("foo",  10);
for (int i = 0; i < 10; i++) {
    final int j = i;
    Mono.just(connection)
        .subscribeOn(scheduler)
        .flatMap(conn -> Mono.from(conn.createStatement("select " + j).execute()))
        .flatMap(result -> Mono.from(result.map((row, meta) -> row.get(0, Integer.class))))
        .doOnNext(System.out::println)
        .subscribe();
}

Depending on the parallelism value of the scheduler I may get an error that the request queue is full. If I fetch a new connection object for every request instead of reusing the same one everything executes in parallel but as far as I can tell there's no way to get them to execute within the same transaction then.

I am using toxiproxy to simulate extra latency to the sql server instance.


问:
JavaScript callback-function in PHP-Array
I have a PHP-array for the Javascript Library chart.js and it´s like this:

$array = [ 'options' => [ 'plugins' => [ 'tooltip' => [ 'callbacks' => [ 'label' => "function(context) { let label = context.dataset.label || ''; if (label) { label += ': '; } if (context.parsed.y !== null) { label += context.parsed.y + ' ' + '€'; } return label; }" ] ] ] ] ];

This PHP-array is requested by AJAX and in JavaScript I have:

new Chart(ctx, array);

array contains the data from the PHP-array.

The problem is the 'label'-element that contains a callback-function for JavaScript. The function does not work in this way. Is it possible to get this to work or do I have to bring the callback-function back to JavaScript and only request the relevant data ('€')? The callback-function isn´t static, so I thought it´s better to have it in PHP.


问:
Issue executing Github Actions
I have an Android Studio project connected to GitHub Actions, but my GitHub actions started to fail and I don't know the reason. For example, the log of working actions was:

```<code>Fetching gem metadata from https://rubygems.org/.
31
Following files may not be writable, so sudo is needed:
32
/var/lib/gems/3.0.0
33
/var/lib/gems/3.0.0/build_info
34
/var/lib/gems/3.0.0/cache
35
/var/lib/gems/3.0.0/doc
36
/var/lib/gems/3.0.0/extensions
37
/var/lib/gems/3.0.0/gems
38
/var/lib/gems/3.0.0/plugins
39
/var/lib/gems/3.0.0/specifications
40
Fetching bundler 2.2.29
41
Installing bundler 2.2.29
</code>```

But now for some reason I'm seeing this and builds fail:

```<code>Fetching bundler 2.2.29
32
Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/bundler-2.2.29.gem`. It is likely that you need to grant write permissions for that path.
33

34
Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/bundler-2.2.29.gem`. It is likely that you need to grant write permissions for that path.
35

36
Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/bundler-2.2.29.gem`. It is likely that you need to grant write permissions for that path.
</code>```

Telling me that I need to grant permission. Any help would be much appreciated.

Title: Issue executing Github Actions

Body:
I have an Android Studio project connected to GitHub Actions, but my GitHub actions started to fail and I don't know the reason. For example, the log of working actions was:

Fetching gem metadata from https://rubygems.org/.
31
Following files may not be writable, so sudo is needed:
32
/var/lib/gems/3.0.0
33
/var/lib/gems/3.0.0/build_info
34
/var/lib/gems/3.0.0/cache
35
/var/lib/gems/3.0.0/doc
36
/var/lib/gems/3.0.0/extensions
37
/var/lib/gems/3.0.0/gems
38
/var/lib/gems/3.0.0/plugins
39
/var/lib/gems/3.0.0/specifications
40
Fetching bundler 2.2.29
41
Installing bundler 2.2.29

But now for some reason I'm seeing this and builds fail:

Fetching bundler 2.2.29
32
Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/bundler-2.2.29.gem`. It is likely that you need to grant write permissions for that path.
33

34
Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/bundler-2.2.29.gem`. It is likely that you need to grant write permissions for that path.
35

36
Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/bundler-2.2.29.gem`. It is likely that you need to grant write permissions for that path.

Telling me that I need to grant permission. Any help would be much appreciated.


问:
How to download a large file in a Spring Boot microservices application?
I am trying to download a large file in a Spring Boot microservices application. Can anyone suggest a way of doing that?

Here is my front-end code

```
<p>AJAX controller code</p>
<pre class="lang-java prettyprint-override"><code>@GetMapping("/download-collector-file/{collectorFileId}")
public ResponseEntity<Resource> downloadCollectorFile(@PathVariable String collectorFileId) {
    System.out.println("kjwenfjkewew beforr");

    ResponseEntity<Resource> r=   fileServiceAPI.downloadCollectorFile("token",collectorFileId, false);

    System.out.println("after api");

    return r;
}
</code>```

Feign client code

@GetMapping("/order-files/read/{id}")
ResponseEntity<Resource> downloadCollectorFile(@RequestHeader("Authorization") String auth,
                                  @PathVariable String id,
                                  @RequestParam("isDownload") Boolean isDownload);
```
<p>And my service back-end API code</p>
```@RequestMapping(value="/{id}" ,  method = RequestMethod.GET )
public ResponseEntity<InputStreamResource> downloadCollectorFile(@RequestHeader("Authorization") String auth, @PathVariable String id, @RequestParam(required = false, value = "isDownload") boolean isDownload) throws TgxValidationException, IOException {
    System.out.println("new file  id------===>"+id);

    Optional<TgxFilesEntity> optionalTgxFilesEntity = tgxFilesRepository.findByIdAndDeletedFalse(id);

    if (optionalTgxFilesEntity.isPresent()) {
        TgxFilesEntity tgxFilesEntity = optionalTgxFilesEntity.get();
        logger.info(">> UPLOAD_FOLDER=" + UPLOAD_FOLDER_PATH);

        String absolutePath = UPLOAD_FOLDER_PATH + "/collector/" + tgxFilesEntity.getRelationalId() + "/";

        final File parent = new File(absolutePath + tgxFilesEntity.getFilename());
        InputStreamResource resource = new InputStreamResource(new FileInputStream(parent));

        String mimeType = URLConnection.guessContentTypeFromName(tgxFilesEntity.getFilename());

        logger.info("mimeType" + mimeType);

        HttpHeaders headers = new HttpHeaders();
        if (!isDownload) {
            headers.add("Content-disposition", "inline; filename=" + tgxFilesEntity.getFilename());
            if (mimeType == null) {
                int lastIndexOf = tgxFilesEntity.getFilename().lastIndexOf(".");
                if (tgxFilesEntity.getFilename().substring(lastIndexOf).contains(".json")) {
                    mimeType = "application/json";
                } else if (tgxFilesEntity.getFilename().substring(lastIndexOf).contains(".xlsx")) {
                    mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                } else if (tgxFilesEntity.getFilename().substring(lastIndexOf).contains(".doc")) {
                    mimeType = "application/msword";
                }
                else if (tgxFilesEntity.getFilename().substring(lastIndexOf).contains(".zip")) {
                    mimeType = "application/zip";
                }
                else {
                    mimeType = "text/plain";
                }
            }
        } else {
            logger.info("hello else");
            headers.add("Content-disposition", "attachment; filename=" + tgxFilesEntity.getFilename());
            mimeType = "multipart/form-data";
        }

        System.out.println("brefore return===>"+resource.getFilename());

        return ResponseEntity.ok().headers(headers).contentType(MediaType.parseMediaType(mimeType)).body(resource);
    } else throw new FileNotFoundException(environment.getProperty("tgx.validation.file_not_found"));
}
```

Basically, it is not working for  larger files like (300mb,400mb).

Is there any better approach of doing this?

Body:
I am trying to download a large file in a Spring Boot microservices application. Can anyone suggest a way of doing that?

Here is my front-end code

AJAX controller code

@GetMapping("/download-collector-file/{collectorFileId}")
public ResponseEntity<Resource> downloadCollectorFile(@PathVariable String collectorFileId) {
    System.out.println("kjwenfjkewew beforr");

    ResponseEntity<Resource> r=   fileServiceAPI.downloadCollectorFile("token",collectorFileId, false);

    System.out.println("after api");

    return r;
}

Feign client code

@GetMapping("/order-files/read/{id}")
ResponseEntity<Resource> downloadCollectorFile(@RequestHeader("Authorization") String auth,
                                  @PathVariable String id,
                                  @RequestParam("isDownload") Boolean isDownload);

And my service back-end API code

@RequestMapping(value="/{id}" ,  method = RequestMethod.GET )
public ResponseEntity<InputStreamResource> downloadCollectorFile(@RequestHeader("Authorization") String auth, @PathVariable String id, @RequestParam(required = false, value = "isDownload") boolean isDownload) throws TgxValidationException, IOException {
    System.out.println("new file  id------===>"+id);

    Optional<TgxFilesEntity> optionalTgxFilesEntity = tgxFilesRepository.findByIdAndDeletedFalse(id);

    if (optionalTgxFilesEntity.isPresent()) {
        TgxFilesEntity tgxFilesEntity = optionalTgxFilesEntity.get();
        logger.info(">> UPLOAD_FOLDER=" + UPLOAD_FOLDER_PATH);

        String absolutePath = UPLOAD_FOLDER_PATH + "/collector/" + tgxFilesEntity.getRelationalId() + "/";

        final File parent = new File(absolutePath + tgxFilesEntity.getFilename());
        InputStreamResource resource = new InputStreamResource(new FileInputStream(parent));

        String mimeType = URLConnection.guessContentTypeFromName(tgxFilesEntity.getFilename());

        logger.info("mimeType" + mimeType);

        HttpHeaders headers = new HttpHeaders();
        if (!isDownload) {
            headers.add("Content-disposition", "inline; filename=" + tgxFilesEntity.getFilename());
            if (mimeType == null) {
                int lastIndexOf = tgxFilesEntity.getFilename().lastIndexOf(".");
                if (tgxFilesEntity.getFilename().substring(lastIndexOf).contains(".json")) {
                    mimeType = "application/json";
                } else if (tgxFilesEntity.getFilename().substring(lastIndexOf).contains(".xlsx")) {
                    mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                } else if (tgxFilesEntity.getFilename().substring(lastIndexOf).contains(".doc")) {
                    mimeType = "application/msword";
                }
                else if (tgxFilesEntity.getFilename().substring(lastIndexOf).contains(".zip")) {
                    mimeType = "application/zip";
                }
                else {
                    mimeType = "text/plain";
                }
            }
        } else {
            logger.info("hello else");
            headers.add("Content-disposition", "attachment; filename=" + tgxFilesEntity.getFilename());
            mimeType = "multipart/form-data";
        }

        System.out.println("brefore return===>"+resource.getFilename());

        return ResponseEntity.ok().headers(headers).contentType(MediaType.parseMediaType(mimeType)).body(resource);
    } else throw new FileNotFoundException(environment.getProperty("tgx.validation.file_not_found"));
}

Basically, it is not working for  larger files like (300mb,400mb).

Is there any better approach of doing this?


问:
Service to intercept client-server websocket communication for purposes of API-untangling
I'm writing a custom client for an existing framework but in a different language than the supported client. Now I would like to intercept the traffic of the existing client-server connection to get a better grasp of the API intrinsics, which is always quite tedious if you have to extract it from the code alone. I had a look at postman but it doesn't seem to allow interception of websocket messages (https appears to be possible thorugh postman interceptor. Is there a similar tool for websockets?

Basically what I'm looking for is just a relay that forwards every request as-is to the server and vice-versa for the response.


问:
Is it good approach to cancel WorkManger task in executeTask() function in flutter
I have to cancel/dispose workmanager task as soon as it gets completed, but most of the times app is not in running state. So is it good or bad to cancel that task in executeTask() function.

Here is code example:
Register task first

```<code> Workmanager().registerOneOffTask('taskABC','taskABC',
      inputData: {'data':'some data here'},);
</code>```

And here is an code inside callbackDispathcer()

```<code>  Workmanager().executeTask((taskName, inputData) async {
try {
  switch(taskName) {
    case 'taskABC':
      //do something here
      Workmanager().cancelByUniqueName('taskABC');
      break;

  }
 return  true;
} catch(e) {
  debugPrint('---> Error in work manager execution taskName[$taskName] with inputData[$inputData] | Exception: $e');
  return false;
}});
</code>```

I just need to know what could be the best way to cancel/dispose a task, when the app is not in running state.

Body:
I have to cancel/dispose workmanager task as soon as it gets completed, but most of the times app is not in running state. So is it good or bad to cancel that task in executeTask() function.

Here is code example:
Register task first

 Workmanager().registerOneOffTask('taskABC','taskABC',
      inputData: {'data':'some data here'},);

And here is an code inside callbackDispathcer()

  Workmanager().executeTask((taskName, inputData) async {
try {
  switch(taskName) {
    case 'taskABC':
      //do something here
      Workmanager().cancelByUniqueName('taskABC');
      break;

  }
 return  true;
} catch(e) {
  debugPrint('---> Error in work manager execution taskName[$taskName] with inputData[$inputData] | Exception: $e');
  return false;
}});

I just need to know what could be the best way to cancel/dispose a task, when the app is not in running state.


问:
Phantomjs no response
I'm using phantomjs for the first time, for a project.
I started from taking screenshots only, the problem is that on some sites phantomjs doesn't work, but it remains blocked (it doesn't even show any errors).
This is the code I used:

```<code>var page = require('webpage').create();
page.settings.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36';
page.viewportSize = { widith: 1920, height: 1080};
page.zoomFactor = 2.0;
page.open('https://www.gucci.com', function(status) {
  console.log("Status: " + status);
  if(status === "success") {
    page.render('gucci.png');
  }
  phantom.exit();
});
</code>```

Also, if I use stackoverflow.com as a site, it returns several errors, a very long and fine screenshot, as if it were taken from a smartphone.

Example of errors:

https://stackoverflow.com/:125
ReferenceError: Can't find variable: StackExchange

https://stackoverflow.com/:363
TypeError: undefined is not a constructor (evaluating 'billingPeriodSwitch.forEach')
```

Title: Phantomjs no response

Body:
I'm using phantomjs for the first time, for a project.
I started from taking screenshots only, the problem is that on some sites phantomjs doesn't work, but it remains blocked (it doesn't even show any errors).
This is the code I used:

var page = require('webpage').create();
page.settings.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36';
page.viewportSize = { widith: 1920, height: 1080};
page.zoomFactor = 2.0;
page.open('https://www.gucci.com', function(status) {
  console.log("Status: " + status);
  if(status === "success") {
    page.render('gucci.png');
  }
  phantom.exit();
});

Also, if I use stackoverflow.com as a site, it returns several errors, a very long and fine screenshot, as if it were taken from a smartphone.

Example of errors:

https://stackoverflow.com/:125
ReferenceError: Can't find variable: StackExchange

https://stackoverflow.com/:363
TypeError: undefined is not a constructor (evaluating 'billingPeriodSwitch.forEach')