问:
How to add descriptor UUID while using CoreBluetooth framework
```<code>let descriptor_uuid_configure: CBUUID = CBUUID(string: CBUUIDCharacteristicUserDescriptionString)
let descriptor = CBMutableDescriptor(type: descriptor_uuid_configure, value: nil)

let dataSenderCharacteristic = CBMutableCharacteristic(type: CBUUID(string: Constants.CHARACTERISTICS_UUID_DATA_SENDER.rawValue), properties: [.read, .notify], value: nil, permissions: [.readable])
    dataSenderCharacteristic.descriptors = [descriptor]

let eventControlCharacteristic = CBMutableCharacteristic(type: CBUUID(string: Constants.CHARACTERISTICS_UUID_CONTROL.rawValue), properties: [.read, .notify], value: nil, permissions: [.readable])
    eventControlCharacteristic.descriptors = [descriptor]

let pingMessageCharacteristic = CBMutableCharacteristic(type: CBUUID(string: Constants.CHARACTERISTICS_UUID_PING.rawValue), properties: [.read, .notify], value: nil, permissions: [.readable])
    pingMessageCharacteristic.descriptors = [descriptor]

let bleService = CBMutableService(type: CBUUID(string: Constants.SERVICE_BLE_GATT.rawValue), primary: true)

bleService.characteristics = [dataSenderCharacteristic, eventControlCharacteristic, pingMessageCharacteristic]
peripheralManager?.add(bleService)
</code>```

This is my code to add descriptor and characteristics for my bleperipheral iOS application.

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Expecting NSString value type for User Description descriptor'

*** First throw call stack:

(0x1d8c2de88 0x1d1f638d8 0x1d3551b4c 0x1f8c535e0 0x10011dd98

0x100118c38 0x10011861c 0x100119c88 0x100119e00 0x1f8c769a0

0x1d30483f0 0x1d305e8d4 0x1d304b860 0x1d304b590 0x1d304a518

0x1f8c21620 0x1f8c20718 0x1f8c20690 0x1006b45a8 0x1006b605c 0x1006be10c 0x1006bee68 0x1006c6670 0x1006c6354 0x1d8cbe6f8

0x1d8ca0058 0x1d8ca4ed4 0x211fa6368 0x1db1833d0 0x1db183034

0x1e1773308 0x100120548 0x1001204d0 0x10012063c 0x1f730c960)

libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception

'NSInternalInconsistencyException', reason: 'Expecting NSString value type for User Description descriptor'
terminating with uncaught exception of type NSException.

Getting the above thread while run the code.Please let me know the solution for the above problem.

Body:
let descriptor_uuid_configure: CBUUID = CBUUID(string: CBUUIDCharacteristicUserDescriptionString)
let descriptor = CBMutableDescriptor(type: descriptor_uuid_configure, value: nil)

let dataSenderCharacteristic = CBMutableCharacteristic(type: CBUUID(string: Constants.CHARACTERISTICS_UUID_DATA_SENDER.rawValue), properties: [.read, .notify], value: nil, permissions: [.readable])
    dataSenderCharacteristic.descriptors = [descriptor]

let eventControlCharacteristic = CBMutableCharacteristic(type: CBUUID(string: Constants.CHARACTERISTICS_UUID_CONTROL.rawValue), properties: [.read, .notify], value: nil, permissions: [.readable])
    eventControlCharacteristic.descriptors = [descriptor]

let pingMessageCharacteristic = CBMutableCharacteristic(type: CBUUID(string: Constants.CHARACTERISTICS_UUID_PING.rawValue), properties: [.read, .notify], value: nil, permissions: [.readable])
    pingMessageCharacteristic.descriptors = [descriptor]

let bleService = CBMutableService(type: CBUUID(string: Constants.SERVICE_BLE_GATT.rawValue), primary: true)

bleService.characteristics = [dataSenderCharacteristic, eventControlCharacteristic, pingMessageCharacteristic]
peripheralManager?.add(bleService)

This is my code to add descriptor and characteristics for my bleperipheral iOS application.

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Expecting NSString value type for User Description descriptor'

*** First throw call stack:

(0x1d8c2de88 0x1d1f638d8 0x1d3551b4c 0x1f8c535e0 0x10011dd98

0x100118c38 0x10011861c 0x100119c88 0x100119e00 0x1f8c769a0

0x1d30483f0 0x1d305e8d4 0x1d304b860 0x1d304b590 0x1d304a518

0x1f8c21620 0x1f8c20718 0x1f8c20690 0x1006b45a8 0x1006b605c 0x1006be10c 0x1006bee68 0x1006c6670 0x1006c6354 0x1d8cbe6f8

0x1d8ca0058 0x1d8ca4ed4 0x211fa6368 0x1db1833d0 0x1db183034

0x1e1773308 0x100120548 0x1001204d0 0x10012063c 0x1f730c960)

libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception

'NSInternalInconsistencyException', reason: 'Expecting NSString value type for User Description descriptor'
terminating with uncaught exception of type NSException.

Getting the above thread while run the code.Please let me know the solution for the above problem.


来源: stackexchange

问:
tradingview wrong alert when closing position
alert should be show as flat when closing but 1 of the alert show as entry

```<code>// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © trollerd7u95813

//@version=5
strategy("test",pyramiding = 2)
mas = ta.ema(close,9)
mal = ta.ema(close,5)
atr = ta.atr(14)

if close > mas
    sl = low - atr*1.5[enter image description here](https://i.stack.imgur.com/QF8IA.png)
    strategy.entry("l",strategy.long)
    strategy.exit("close",'l',stop = sl)

plot(mas)

</code>```

enter image description here

how to fix it thanks

ContentLicense: CC BY-SA 4.0

Body:
alert should be show as flat when closing but 1 of the alert show as entry

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © trollerd7u95813

//@version=5
strategy("test",pyramiding = 2)
mas = ta.ema(close,9)
mal = ta.ema(close,5)
atr = ta.atr(14)

if close > mas
    sl = low - atr*1.5[enter image description here](https://i.stack.imgur.com/QF8IA.png)
    strategy.entry("l",strategy.long)
    strategy.exit("close",'l',stop = sl)

plot(mas)

enter image description here

how to fix it thanks


问:
How To Implement Speech Synthesis Into Capacitor App
I built a web application, with just HTML, JS, and CSS. My app relies on the web implementation of the Speech Synthesis. When converting my app to a capacitor application, I’m having trouble getting the capacitor speech recognition to work since I was originally using the built-in browser Speech Synthesis which is not supported when debugging my app I get the Uncaught ReferenceError: SpeechSynthesisUtterance is not defined. Any help would be greatly appreciated.

I tried implementing the steps from the capactor help guide
Implementing for Web/PWAs from the following link https://capacitorjs.com/docs/plugins/tutorial/web. This is all new to me, since i'm use to just coding HTML, Javascript and CSS and nothing else. Any help would be greatly appreciated.


问:
Custom Circular Progress Bar Using React-Native (Without using any third party libraries)
Hi I am designing a reporting page for my react-native app. I need to show a circular progress bar and an integer value (0-8) in the middle. I have tried multiple third parties libraries and I am getting similar errors in all of the SVG libraries. So, I want to build a custom circular bar using react-native components. I have already developed a code for it, but the circle is always filled to the full value. I want to change it to the percentage completion of the variable I am passing.
For instance, I passed 4 (the range of the variable is 0-8). So the circle should be 50% filled. But as per my code, it seems not to change at all and always appears full.
I am pasting my full code below and my current output as well.
Can someone please help me with this circle progress-filling issue?

```<code>import React from 'react';
import { View, Text, StyleSheet, Animated } from 'react-native';

const CircularProgressBar = ({ value }) => {
  const circumference = 2 * Math.PI * (100 / 2);
  const strokeDashoffset = new Animated.Value(circumference);

  React.useEffect(() => {
    Animated.timing(strokeDashoffset, {
      toValue: (1 - value / 100) * circumference,
      duration: 1000,
      useNativeDriver: false
    }).start();
  }, [value]);

  return (
    <View style={styles.container}>
      <View style={styles.circle}>
        <Animated.View
          style={[
            styles.bar,
            {
              strokeDashoffset,
              strokeDasharray: `${circumference} ${circumference}`
            }
          ]}
        />
        <Text style={styles.text}>{value}</Text>
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    alignItems: 'center',
    justifyContent: 'center'
  },
  circle: {
    width: 200,
    height: 200,
    borderRadius: 100,
    borderWidth: 20,
    borderColor: "#FF4433",
    alignItems: 'center',
    justifyContent: 'center'
  },
  bar: {
    width: 100,
    height: 100,
    borderRadius: 50,
    borderColor: '#FFD580',
    borderWidth: 20,
    transform: [{ rotate: '-90deg' }],
    position: 'absolute'
  },
  text: {
    fontSize: 43,
    color: '#FFD580'

  }
});

export default CircularProgressBar;

</code>```

The output of this code looks like this

Body:
Hi I am designing a reporting page for my react-native app. I need to show a circular progress bar and an integer value (0-8) in the middle. I have tried multiple third parties libraries and I am getting similar errors in all of the SVG libraries. So, I want to build a custom circular bar using react-native components. I have already developed a code for it, but the circle is always filled to the full value. I want to change it to the percentage completion of the variable I am passing.
For instance, I passed 4 (the range of the variable is 0-8). So the circle should be 50% filled. But as per my code, it seems not to change at all and always appears full.
I am pasting my full code below and my current output as well.
Can someone please help me with this circle progress-filling issue?

import React from 'react';
import { View, Text, StyleSheet, Animated } from 'react-native';

const CircularProgressBar = ({ value }) => {
  const circumference = 2 * Math.PI * (100 / 2);
  const strokeDashoffset = new Animated.Value(circumference);

  React.useEffect(() => {
    Animated.timing(strokeDashoffset, {
      toValue: (1 - value / 100) * circumference,
      duration: 1000,
      useNativeDriver: false
    }).start();
  }, [value]);

  return (
    <View style={styles.container}>
      <View style={styles.circle}>
        <Animated.View
          style={[
            styles.bar,
            {
              strokeDashoffset,
              strokeDasharray: `${circumference} ${circumference}`
            }
          ]}
        />
        <Text style={styles.text}>{value}</Text>
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    alignItems: 'center',
    justifyContent: 'center'
  },
  circle: {
    width: 200,
    height: 200,
    borderRadius: 100,
    borderWidth: 20,
    borderColor: "#FF4433",
    alignItems: 'center',
    justifyContent: 'center'
  },
  bar: {
    width: 100,
    height: 100,
    borderRadius: 50,
    borderColor: '#FFD580',
    borderWidth: 20,
    transform: [{ rotate: '-90deg' }],
    position: 'absolute'
  },
  text: {
    fontSize: 43,
    color: '#FFD580'

  }
});

export default CircularProgressBar;

The output of this code looks like this


问:
While performing Authorization Http client call not working in Blazor application
We are making a WebAPI call through HTTP client and this call is prevented when authorization is enabled in the Blazor application.

We just need to trigger the PostCount method in the controller. But it is not triggering when the authorization code is added to the Program.cs file.

https://github.com/Indhumathy-Loganathan/NewAuthorizationSample/blob/main/Program.cs#L14

If you remove that Authorization code, then the API call will trigger properly. For now, it will only throw an error since we don't make any customizations at the server end. All we need is to trigger the API PostCount method, so set the breakpoint in that method to test this issue.


问:
Reuse views and controller logic in MVC3
in my MVC3 based application I often need to reuse the same functionality in different views.

Example: One view to search for users. Another view to show the search results and enable the user to select one or more of the returned records. At the end those records have to be passed to the original view/controller.

How can I use (if at all) RenderAction and a, let's say, UserAccountSelectionController to build a reusable set of controller(s) and views? How would my reusable controller "know" where to pass the selected user models to? Is there a different approach to create reusable components the MVC3 way?

Your help is greatly appreciated.

Regards,
Kevin

ContentLicense: CC BY-SA 3.0


问:
Getting this error : 'The Remote Java Bridge has not been attached yet.' while connecting to hdfs from external table in sql server
I tried to create a external table in sql server pointing to hdfs, but getting the below error

Msg 110813, Level 16, State 1, Line 16
105019;External file access failed due to internal error: 'The Remote Java Bridge has not been attached yet.'

enter image description here

I have configured Hadoop and SLQ Server on Ubuntu-20.04 and installed polybase as well.
-> SQL Server version - 2019
-> hadoop-3.3.0

Below are the queries I have executed.

```<code>CREATE EXTERNAL DATA SOURCE [HadoopDFS1]
WITH (
    TYPE = Hadoop,
    LOCATION = N'hdfs://localhost:9000'
)

CREATE EXTERNAL FILE FORMAT CSVFF WITH (
      FORMAT_TYPE = DELIMITEDTEXT,
      FORMAT_OPTIONS (FIELD_TERMINATOR =',',
            USE_TYPE_DEFAULT = TRUE));

CREATE EXTERNAL TABLE [dbo].[Salary] (
      [Company Name] nvarchar(200),
      [Job Title] nvarchar(100),
      [Salaries Reported] int,
      [Location] nvarchar(50)
)
WITH (LOCATION='/Data/input/',
      DATA_SOURCE = HadoopDFS,
      FILE_FORMAT = CSVFF
);
</code>```

Body:
I tried to create a external table in sql server pointing to hdfs, but getting the below error

Msg 110813, Level 16, State 1, Line 16
105019;External file access failed due to internal error: 'The Remote Java Bridge has not been attached yet.'

enter image description here

I have configured Hadoop and SLQ Server on Ubuntu-20.04 and installed polybase as well.
-> SQL Server version - 2019
-> hadoop-3.3.0

Below are the queries I have executed.

CREATE EXTERNAL DATA SOURCE [HadoopDFS1]
WITH (
    TYPE = Hadoop,
    LOCATION = N'hdfs://localhost:9000'
)

CREATE EXTERNAL FILE FORMAT CSVFF WITH (
      FORMAT_TYPE = DELIMITEDTEXT,
      FORMAT_OPTIONS (FIELD_TERMINATOR =',',
            USE_TYPE_DEFAULT = TRUE));

CREATE EXTERNAL TABLE [dbo].[Salary] (
      [Company Name] nvarchar(200),
      [Job Title] nvarchar(100),
      [Salaries Reported] int,
      [Location] nvarchar(50)
)
WITH (LOCATION='/Data/input/',
      DATA_SOURCE = HadoopDFS,
      FILE_FORMAT = CSVFF
);


问:
Is it possible to use the audio from external apps (eg. Spotify) running in the background as input to AvCaptureInput when developing an iOS App?
I've looked through all the posts online and the Apple Developer Documentation, but nothing seems to comment on this. I want to be able to live-record the audio coming from, say, Spotify or another app that's running in the background, and process this audio data in my own app. This seems to be possible on Android.

I haven't actually coded it out yet but I've read through the documentation fully and previous stackoverflow posts.


问:
Why there is a fluctuation in Validation and Train Plot
I am new to LSTM. My data contain 1381 data point and one column. Train set=1104 and Test set=277. I used LSTM to predict the values. So I had given past data points as 120, layer=2, and epoch=10. After predicting the values, I plotted the validation and training, but my plot looked like this.

Anyone, please help me? Why does the plot look like this?


问:
Mismatched type error with functions in a hash map
I am trying to create a hash map where the key is a string and the value is a function fn(&f32,&f32) -> f32. The error gives me mismatched types and I do not know what I am missing.

use std::collections{Hashmap}
use lazy_static::lazy_static;
// declared functions
fn fnc1(x:&f32, y: &f32) -> f32 {
    x+y
}
fn fnc2(x:&f32, y: &f32) -> f32 {
    x-y
}

// creating and populating hashmap

lazy_static! {
    static ref OPS: HashMap<&'static str, fn(&f32, &f32) -> f32> = {
        let mut m = HashMap::new();
        m.insert("sum", fnc1);
        m.insert("minus", fnc2); // Error occurs on this line with fnc
        m
    };
```
<p>Error below</p>
```mismatched types
expected fn item `for<'a, 'b> fn(&'a f32, &'b f32) -> _ {fnc1}`
   found fn item `for<'a, 'b> fn(&'a f32, &'b f32) -> _ {fnc2}`
constraint.rs(24, 11): arguments to this function are incorrect
map.rs(1103, 12): associated function defined here
```

Body:
I am trying to create a hash map where the key is a string and the value is a function fn(&f32,&f32) -> f32. The error gives me mismatched types and I do not know what I am missing.

use std::collections{Hashmap}
use lazy_static::lazy_static;
// declared functions
fn fnc1(x:&f32, y: &f32) -> f32 {
    x+y
}
fn fnc2(x:&f32, y: &f32) -> f32 {
    x-y
}

// creating and populating hashmap

lazy_static! {
    static ref OPS: HashMap<&'static str, fn(&f32, &f32) -> f32> = {
        let mut m = HashMap::new();
        m.insert("sum", fnc1);
        m.insert("minus", fnc2); // Error occurs on this line with fnc
        m
    };

Error below

mismatched types
expected fn item `for<'a, 'b> fn(&'a f32, &'b f32) -> _ {fnc1}`
   found fn item `for<'a, 'b> fn(&'a f32, &'b f32) -> _ {fnc2}`
constraint.rs(24, 11): arguments to this function are incorrect
map.rs(1103, 12): associated function defined here


问:
Redux + Persist with tab state sync and disabling serializableCheck
I use redux toolkit + redux-persist with state sync across tabs, everything works fine, config looks like this:

```<code>export const store = configureStore({
    reducer: persistedReducer,
    middleware: [
      createStateSyncMiddleware({
        blacklist: ['persist/PERSIST', 'persist/REHYDRATE'],
      }),
    ],

  });
</code>```

But for now I have to store some non serializable data and by default catch an error in my console (that's also expected, despite of console warnings all works fine)

So my goal is to turn off serializableCheck and still use existing middleware (createStateSyncMiddleware).

I tried to combine middleware :

```<code>const config = {
  blacklist: ['persist/PERSIST', 'persist/REHYDRATE'],
};
const synckStateMiddleware = [createStateSyncMiddleware(config)];

export const store = configureStore({
  reducer: persistedReducer,
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      immutableCheck: false,
      serializableCheck: false,
    }).concat(synckStateMiddleware),
});
</code>```

Result: state sync works fine, but non-serialise warning still exist

When I use this code (delete concat middleware with sync state):

```<code>export const store = configureStore({
  reducer: persistedReducer,
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      immutableCheck: false,
      serializableCheck: false,
    }),
});
</code>```

Result: no warnings, but state sync is broken, of course.

Body:
I use redux toolkit + redux-persist with state sync across tabs, everything works fine, config looks like this:

export const store = configureStore({
    reducer: persistedReducer,
    middleware: [
      createStateSyncMiddleware({
        blacklist: ['persist/PERSIST', 'persist/REHYDRATE'],
      }),
    ],

  });

But for now I have to store some non serializable data and by default catch an error in my console (that's also expected, despite of console warnings all works fine)

So my goal is to turn off serializableCheck and still use existing middleware (createStateSyncMiddleware).

I tried to combine middleware :

const config = {
  blacklist: ['persist/PERSIST', 'persist/REHYDRATE'],
};
const synckStateMiddleware = [createStateSyncMiddleware(config)];

export const store = configureStore({
  reducer: persistedReducer,
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      immutableCheck: false,
      serializableCheck: false,
    }).concat(synckStateMiddleware),
});

Result: state sync works fine, but non-serialise warning still exist

When I use this code (delete concat middleware with sync state):

export const store = configureStore({
  reducer: persistedReducer,
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      immutableCheck: false,
      serializableCheck: false,
    }),
});

Result: no warnings, but state sync is broken, of course.


问:
Not able to bind data from Umbraco BlockList data by my API method
I have created a blocklist in Umbraco. I need that list data in my blazor page so I created an api method to fetch that data. I am getting data but not able to map/bind in my own model. That list also has an image element.</p>
```<code> public async Task<EmployeeDetailsLayout.EmployeeDetails> GetCompanyEmployeesLayoutpage(GenericContentPage genericContentPage)
        {
            try
            {

                EmployeeDetailsLayout.EmployeeDetails listEmployeeLayout = new EmployeeDetailsLayout.EmployeeDetails();

                if (_umbracoHelperAccessor.TryGetUmbracoHelper(out var umbracoHelper) is false)
                {
                    throw new Exception("Unable to get Umbraco Helper");
                }
                var _node1 = umbracoHelper.Content(1257);
                // var contentPage = GetGenericContentPage("companyemployees");
                if (_node1 is not null)
                {
                    var result = _node1.Value<dynamic>("Employees");
                    //   genericContentPage.BlockList.Select(x => x.GetCorrespondingElementModel()).ToList();
                    foreach (var item in result)
                    {
                        listEmployeeLayout.blockItems.Add(new EmployeeDetailsLayout.BlockItems { EmployeeName = item.Content.EmployeeName, EmployeeEmail = item.Content.EmployeeEmail, EmployeePosition = item.Content.EmployeePosition, EmployeePhone = item.Content.EmployeePhone, EmployeeImage= item.Content }) ;
                    }
                }
                // listEmployeeLayout = _mapper.Map<EmployeeDetailsLayout.EmployeeDetails>(listEmployeeLayout);
                return listEmployeeLayout;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
</code>```

Body:
I have created a blocklist in Umbraco. I need that list data in my blazor page so I created an api method to fetch that data. I am getting data but not able to map/bind in my own model. That list also has an image element.

 public async Task<EmployeeDetailsLayout.EmployeeDetails> GetCompanyEmployeesLayoutpage(GenericContentPage genericContentPage)
        {
            try
            {

                EmployeeDetailsLayout.EmployeeDetails listEmployeeLayout = new EmployeeDetailsLayout.EmployeeDetails();

                if (_umbracoHelperAccessor.TryGetUmbracoHelper(out var umbracoHelper) is false)
                {
                    throw new Exception("Unable to get Umbraco Helper");
                }
                var _node1 = umbracoHelper.Content(1257);
                // var contentPage = GetGenericContentPage("companyemployees");
                if (_node1 is not null)
                {
                    var result = _node1.Value<dynamic>("Employees");
                    //   genericContentPage.BlockList.Select(x => x.GetCorrespondingElementModel()).ToList();
                    foreach (var item in result)
                    {
                        listEmployeeLayout.blockItems.Add(new EmployeeDetailsLayout.BlockItems { EmployeeName = item.Content.EmployeeName, EmployeeEmail = item.Content.EmployeeEmail, EmployeePosition = item.Content.EmployeePosition, EmployeePhone = item.Content.EmployeePhone, EmployeeImage= item.Content }) ;
                    }
                }
                // listEmployeeLayout = _mapper.Map<EmployeeDetailsLayout.EmployeeDetails>(listEmployeeLayout);
                return listEmployeeLayout;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }


问:
How to implement a common Authentication Handler for different Http Clients in .NET 6?
I am currently refactoring an old written .NET API, after migrating it to .NET 6. There are 5 different third party API calls that are made from this API to gather data.
We have used Refit to write interfaces for each of these 5 clients. Now we need to implement an authentication handler which adds headers for Service Mesh Authentication. I am planning to write a delegating handler but each of these 5 clients might use different values. I am not sure how to handle this while adding the common handler using Dependency Injection. Please refer the code below:

```<code>//Client 1
services.AddRefitClient<IExternalHttpClient1>()
.ConfigureHttpClient(client => client.BaseAddress = new Uri(Configuration["UrlKey"]))
.AddHttpMessageHandler<ServiceMeshAuthHeaderHandler>();

//Client 2
services.AddRefitClient<IExternalHttpClient2>()
.ConfigureHttpClient(client => client.BaseAddress = new Uri(Configuration["UrlKey"]))
.AddHttpMessageHandler<ServiceMeshAuthHeaderHandler>();
</code>```

ServiceMeshAuthHeaderHandler is the code which generates header for authentication for a client. The code to generate header will be same but the header value will differ based on the which client we want to call.

```<code>public class ServiceMeshAuthHeaderHandler : DelegatingHandler
{
    private readonly ServiceMeshConfiguration _serviceMeshConfiguration;
    private readonly IRSACryptoServiceManager _rsaCryptoServiceManager;
    private readonly ILogger<RSACryptoServiceManager> _logger;

......

    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
    CancellationToken cancellationToken)

    {
        // Based on values in _serviceMeshConfiguration, generate headers for a client
        return await base.SendAsync(request, cancellationToken);
    }
}
</code>```

I know I am missing something very trivial here but right now the best solution is not clicking to me. One approach can be to derive 5 classes for each client from ServiceMeshAuthHeaderHandler, each having its unique _serviceMeshConfiguration for the respective client and then call the base abstract class method having common functionality. But I am not sure if this is the optimal solution. Any suggestions ?

Body:
I am currently refactoring an old written .NET API, after migrating it to .NET 6. There are 5 different third party API calls that are made from this API to gather data.
We have used Refit to write interfaces for each of these 5 clients. Now we need to implement an authentication handler which adds headers for Service Mesh Authentication. I am planning to write a delegating handler but each of these 5 clients might use different values. I am not sure how to handle this while adding the common handler using Dependency Injection. Please refer the code below:

//Client 1
services.AddRefitClient<IExternalHttpClient1>()
.ConfigureHttpClient(client => client.BaseAddress = new Uri(Configuration["UrlKey"]))
.AddHttpMessageHandler<ServiceMeshAuthHeaderHandler>();

//Client 2
services.AddRefitClient<IExternalHttpClient2>()
.ConfigureHttpClient(client => client.BaseAddress = new Uri(Configuration["UrlKey"]))
.AddHttpMessageHandler<ServiceMeshAuthHeaderHandler>();

ServiceMeshAuthHeaderHandler is the code which generates header for authentication for a client. The code to generate header will be same but the header value will differ based on the which client we want to call.

public class ServiceMeshAuthHeaderHandler : DelegatingHandler
{
    private readonly ServiceMeshConfiguration _serviceMeshConfiguration;
    private readonly IRSACryptoServiceManager _rsaCryptoServiceManager;
    private readonly ILogger<RSACryptoServiceManager> _logger;

......

    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
    CancellationToken cancellationToken)

    {
        // Based on values in _serviceMeshConfiguration, generate headers for a client
        return await base.SendAsync(request, cancellationToken);
    }
}

I know I am missing something very trivial here but right now the best solution is not clicking to me. One approach can be to derive 5 classes for each client from ServiceMeshAuthHeaderHandler, each having its unique _serviceMeshConfiguration for the respective client and then call the base abstract class method having common functionality. But I am not sure if this is the optimal solution. Any suggestions ?


问:
stt.node version incompatible with electron
I'm getting below error when trying to launch the application.

This is after I deleted node_modules and re-ran npm i to pull packages again

```<code>App threw an error during load
node_modules/electron/dist/resources/default_app.asar/main.js:113
Error: Cannot find module '/home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/stt/lib/binding/v1.4.0/linux-x64/electron-v17.4/stt.node'
Require stack:
- /home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/stt/index.js
- /home/korodarn/projects/mygit/sight-words-solid-electron/dist/main/index.cjs
- /home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/electron/dist/resources/default_app.asar/main.js
-
    at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Function.n._resolveFilename (node:electron/js2c/browser_init:249:1105)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/stt/index.js:24:17)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
</code>```

I've tried electron-rebuild ( invoked with node_modules/.bin/electron-rebuild )  and it completes successfully but it seems to only rebuild the canvas dependency based on the output.

I am not able to follow the coqui stt documentation well enough to know where to go next.

Body:
I'm getting below error when trying to launch the application.

This is after I deleted node_modules and re-ran npm i to pull packages again

App threw an error during load
node_modules/electron/dist/resources/default_app.asar/main.js:113
Error: Cannot find module '/home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/stt/lib/binding/v1.4.0/linux-x64/electron-v17.4/stt.node'
Require stack:
- /home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/stt/index.js
- /home/korodarn/projects/mygit/sight-words-solid-electron/dist/main/index.cjs
- /home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/electron/dist/resources/default_app.asar/main.js
-
    at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Function.n._resolveFilename (node:electron/js2c/browser_init:249:1105)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/korodarn/projects/mygit/sight-words-solid-electron/node_modules/stt/index.js:24:17)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)

I've tried electron-rebuild ( invoked with node_modules/.bin/electron-rebuild )  and it completes successfully but it seems to only rebuild the canvas dependency based on the output.

I am not able to follow the coqui stt documentation well enough to know where to go next.


问:
time out error of dev tool record and replay
while using dev tool record and play for testing a website when a new window is opened or a new url is loaded then a time out issue occurs in the replay mode. How we can fix this issue and replay the recorded actions completely without errors

I tried to wait the replay action to load the site and return the result


问:
How to access Mina UDP headers details?
Documentations doesn't mention about this either, i need this to implement keep-alive or heartbeat mechanism for my UDP Server which again marked as TBD in here;

I can achieve this using Spring Syslog but it seems impossible and tedious to change my codes in production to fulfil this last minute requirement

Title: How to access Mina UDP headers details?


问:
Can vectors share the same memory space?
Consider this program:

```<code>#include <vector>
#include <iostream>
using std::vector;

int main(){
    vector<vector<double>> A; A.reserve(3);

    vector<double> row1 = {0, 0, 5};
    vector<double> row2 = {0, -3, 0};
    vector<double> row3 = {1.5, 0, 0};

    A.push_back(row1); A.push_back(std::move(row2)); A.push_back(row3);

    for (int i = 0 ; i < 3 ; i++){
        for (int j = 0 ; j < 3 ; j++){
            std::printf("%-7.2f", A[i][j]);
        }
        std::cout << std::endl;
    }
    std::cout << std::endl;

}
</code>```

In the Xcode debugger, it's easy to see that by the time the for loop is reached, row2 is empty (it's contents 'stolen' by std::move), whereas row1 and row3 were only copied, and still maintain their values.

My question is exactly this: does the object A[0] point to the exact same memory location that row1 points to at this point? In other words, is row1's contents in a copy-on-write state, where as soon as either row1 or A[0] modify their contents a copy is created, but in the meantime, they share the memory containing {0, 0, 5} and there is nothing additional allocated.

I am asking this because I am computing the determinant of a matrix, passing in a const std::vector<std::vector<double>> &, and I don't want any additional memory used, but rather, the memory of that object itself.

Body:
Consider this program:

#include <vector>
#include <iostream>
using std::vector;

int main(){
    vector<vector<double>> A; A.reserve(3);

    vector<double> row1 = {0, 0, 5};
    vector<double> row2 = {0, -3, 0};
    vector<double> row3 = {1.5, 0, 0};

    A.push_back(row1); A.push_back(std::move(row2)); A.push_back(row3);

    for (int i = 0 ; i < 3 ; i++){
        for (int j = 0 ; j < 3 ; j++){
            std::printf("%-7.2f", A[i][j]);
        }
        std::cout << std::endl;
    }
    std::cout << std::endl;

}

In the Xcode debugger, it's easy to see that by the time the for loop is reached, row2 is empty (it's contents 'stolen' by std::move), whereas row1 and row3 were only copied, and still maintain their values.

My question is exactly this: does the object A[0] point to the exact same memory location that row1 points to at this point? In other words, is row1's contents in a copy-on-write state, where as soon as either row1 or A[0] modify their contents a copy is created, but in the meantime, they share the memory containing {0, 0, 5} and there is nothing additional allocated.

I am asking this because I am computing the determinant of a matrix, passing in a const std::vector<std::vector<double>> &, and I don't want any additional memory used, but rather, the memory of that object itself.


问:
How to configure Xdebug in VS Code for Magento 2
I am trying configure Xdebug in VS Code to debug Magento 2. But when I tried to run "Listen for Xdebug" its not stopping at the breakpoints.

My lunch.json file:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "args": [
                "--extensionDevelopmentPath=${workspaceFolder}"
            ],
            "name": "Launch Extension",
            "outFiles": [
                "${workspaceFolder}/out/**/*.js"
            ],
            "preLaunchTask": "npm",
            "request": "launch",
            "type": "pwa-extensionHost"
        },

        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "stopOnEntry": true,
            "log": true,
            "pathMappings": {"/var/wwww/html":"${workspaceRoot}"}
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 0,
            "log": true,
            "runtimeArgs": [
                "-dxdebug.start_with_request=yes"
            ],
            "env": {
                "XDEBUG_MODE": "debug,develop",
                "XDEBUG_CONFIG": "client_port=${port}"
            }
        },
        {
            "name": "Launch Built-in web server",
            "type": "php",
            "request": "launch",
            "log": true,
            "runtimeArgs": [
                "-dxdebug.mode=debug",
                "-dxdebug.start_with_request=yes",
                "-S",
                "localhost:8000"
            ],
            "program": "",
            "cwd": "${workspaceRoot}",
            "port": 9003,
            "serverReadyAction": {
                "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
                "uriFormat": "http://localhost:%s",
                "action": "openExternally"
            }
        }
    ]
}
```
<p><code>/etc/php/7.4/mods-available/xdebug.ini</code> file:</p>
<pre class="lang-ini prettyprint-override"><code>zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9003 #if you want to change the port you can change
xdebug.max_nesting_level = 500
xdebug.mode=debug
</code>```

Can anyone help me to understand what I am missing?

Body:
I am trying configure Xdebug in VS Code to debug Magento 2. But when I tried to run "Listen for Xdebug" its not stopping at the breakpoints.

My lunch.json file:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "args": [
                "--extensionDevelopmentPath=${workspaceFolder}"
            ],
            "name": "Launch Extension",
            "outFiles": [
                "${workspaceFolder}/out/**/*.js"
            ],
            "preLaunchTask": "npm",
            "request": "launch",
            "type": "pwa-extensionHost"
        },

        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "stopOnEntry": true,
            "log": true,
            "pathMappings": {"/var/wwww/html":"${workspaceRoot}"}
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 0,
            "log": true,
            "runtimeArgs": [
                "-dxdebug.start_with_request=yes"
            ],
            "env": {
                "XDEBUG_MODE": "debug,develop",
                "XDEBUG_CONFIG": "client_port=${port}"
            }
        },
        {
            "name": "Launch Built-in web server",
            "type": "php",
            "request": "launch",
            "log": true,
            "runtimeArgs": [
                "-dxdebug.mode=debug",
                "-dxdebug.start_with_request=yes",
                "-S",
                "localhost:8000"
            ],
            "program": "",
            "cwd": "${workspaceRoot}",
            "port": 9003,
            "serverReadyAction": {
                "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
                "uriFormat": "http://localhost:%s",
                "action": "openExternally"
            }
        }
    ]
}

/etc/php/7.4/mods-available/xdebug.ini file:

zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9003 #if you want to change the port you can change
xdebug.max_nesting_level = 500
xdebug.mode=debug

Can anyone help me to understand what I am missing?


问:
Import .VCF file directly without downloading to storage
5

I am creating a HTML page with JavaScript, I want it to work at both iOS and Android, when my button is clicked, the browser should ask to open this .vcf by “contact”, or default opening by “contact” and user can save it. Especially for Android, An Android phone need to import manually the VCF by opening “contact” and select “import from” storage. That isn’t user friendly! I am wondering if the code itself can request automatically the inbuilt “contact”app.

Open vCard with Javascript this is similar question but did not solve for android

I tried window.open() and it download my VCF on chrome instead of opening it, I will test on phone tomorrow but probably same situation will happen because browser can’t recognize VCF format


问:
is it possible to choose the device when build running build ios command
I want to using this command to build ios app in iPhone XR:

```<code>➜  flutter-netease-music git:(master) ✗ ~/fvm/versions/2.5.0/bin/flutter build ios --release

Building com.reddwarf.musicapp for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: 6JP4P88ZJB
Running Xcode build...
 └─Compiling, linking and signing...                         5.2s
Xcode build done.                                           14.9s
Built /Users/xiaoqiangjiang/source/reddwarf/frontend/flutter-netease-music/build/ios/iphoneos/Runner.app.
</code>```

when this command finished, the app did not run in the real device, is it possible to choose the device when using this command? I have tried this command seems did not work:

```<code> ~/fvm/versions/2.5.0/bin/flutter build ios --release -d "xiaoqiang 的 iPhone (mobile) "
</code>```

Body:
I want to using this command to build ios app in iPhone XR:

➜  flutter-netease-music git:(master) ✗ ~/fvm/versions/2.5.0/bin/flutter build ios --release

Building com.reddwarf.musicapp for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: 6JP4P88ZJB
Running Xcode build...
 └─Compiling, linking and signing...                         5.2s
Xcode build done.                                           14.9s
Built /Users/xiaoqiangjiang/source/reddwarf/frontend/flutter-netease-music/build/ios/iphoneos/Runner.app.

when this command finished, the app did not run in the real device, is it possible to choose the device when using this command? I have tried this command seems did not work:

 ~/fvm/versions/2.5.0/bin/flutter build ios --release -d "xiaoqiang 的 iPhone (mobile) "


问:
after error by enable migration in asp.net mvc not core
Unable to determine the principal end of an association between the types 'ClassLibraries.Entities.Product' and 'ClassLibraries.Entities.Category'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.

this is the error

successfully enabled migrations


问:
How to change the code as more Scala-like one regarding in the point of resource close?
Below is the scala code that use s3 client and open the s3 bucket and read the object.

```<code>  def readS3(
                            region: String,
                            bucket: String,
                            key: String,
                            fromLine: Int,
                            toLine: Int,
                            lineSeparator: String,
                          ): String = {
    val client = S3Client.builder()
      .region(Region.of(region))
      .build()
    val objectRequest = GetObjectRequest.builder()
      .key(key)
      .bucket(bucket)
      .build()
    val objectBytes = client.getObjectAsBytes(objectRequest)
    val in = objectBytes.asInputStream()
    val bufferedReader = new BufferedReader(new InputStreamReader(in))
    try {
      val sb = readLine(fromLine, toLine, 1, lineSeparator, bufferedReader, new mutable.StringBuilder)
      sb.toString
    } finally {
      in.close()
      bufferedReader.close()
      client.close()
    }
  }
</code>```

As you can see, I tried to close all the resource-related objects in the finally clause.
However, I think that I can change the code as more Scala-like version
because it seems to be Java-like as I think.
I think that in the code above instead of creating s3 client object every time, I am able to use lazy keyword to prevent creating every s3 client object.
And also, I didn't like the way that I use the close in the finally clause.
Instead of closing the resourcing in the finally, is there any other way to achieve my goal?

Note that I am using the Scala version 2.12, so I cannot use command for resource management.

Thanks.

Body:
Below is the scala code that use s3 client and open the s3 bucket and read the object.

  def readS3(
                            region: String,
                            bucket: String,
                            key: String,
                            fromLine: Int,
                            toLine: Int,
                            lineSeparator: String,
                          ): String = {
    val client = S3Client.builder()
      .region(Region.of(region))
      .build()
    val objectRequest = GetObjectRequest.builder()
      .key(key)
      .bucket(bucket)
      .build()
    val objectBytes = client.getObjectAsBytes(objectRequest)
    val in = objectBytes.asInputStream()
    val bufferedReader = new BufferedReader(new InputStreamReader(in))
    try {
      val sb = readLine(fromLine, toLine, 1, lineSeparator, bufferedReader, new mutable.StringBuilder)
      sb.toString
    } finally {
      in.close()
      bufferedReader.close()
      client.close()
    }
  }

As you can see, I tried to close all the resource-related objects in the finally clause.
However, I think that I can change the code as more Scala-like version
because it seems to be Java-like as I think.
I think that in the code above instead of creating s3 client object every time, I am able to use lazy keyword to prevent creating every s3 client object.
And also, I didn't like the way that I use the close in the finally clause.
Instead of closing the resourcing in the finally, is there any other way to achieve my goal?

Note that I am using the Scala version 2.12, so I cannot use command for resource management.

Thanks.


问:
Flutter Hive losing the Data When App is removed From Background
Hello Guys I'm new to the Flutter. I'm storing the API Response in Hive Package and retrieving from Hive. Everything is working fine. But when I killed the App from Background and launch again I'm getting the Error.

 Box not found. Did you forget to call Hive.openBox()?

But here I already Opened the Box and Didn't Closed. I checked in the Physical device and with Release Build.

organizationDetailsBox = Hive.box(myOrganizationDetailsHBox);

My Flutter Version Details:

```<code>Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.22621.963], locale en-IN)
    • Flutter version 3.3.9 on channel stable at C:\FlutterSDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8f7f1f986 (5 weeks ago), 2022-11-23 06:43:51 +0900
    • Engine revision 8f2221fbef
    • Dart version 2.18.5
    • DevTools version 2.15.0

</code>```

Tried in Different Physical Devices with Different Version, getting the Same Issue.

Body:
Hello Guys I'm new to the Flutter. I'm storing the API Response in Hive Package and retrieving from Hive. Everything is working fine. But when I killed the App from Background and launch again I'm getting the Error.

 Box not found. Did you forget to call Hive.openBox()?

But here I already Opened the Box and Didn't Closed. I checked in the Physical device and with Release Build.

organizationDetailsBox = Hive.box(myOrganizationDetailsHBox);

My Flutter Version Details:

Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.22621.963], locale en-IN)
    • Flutter version 3.3.9 on channel stable at C:\FlutterSDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8f7f1f986 (5 weeks ago), 2022-11-23 06:43:51 +0900
    • Engine revision 8f2221fbef
    • Dart version 2.18.5
    • DevTools version 2.15.0

Tried in Different Physical Devices with Different Version, getting the Same Issue.


问:
AWS SDK ResourceConflictException: The operation cannot be performed at this time. The function is currently in the following state: Pending
Getting ResourceConflictException while invoking the lambda function just created before. It used to work about a year or so ago but not it works ONLY if I add delay between create function and invoke function (at least 1 second). Any idea why invoke fails with message:

```<code>ResourceConflictException: The operation cannot be performed at this time. The function is currently in the following state: Pending
</code>```

Here is the code snippet (tried client node versions 14/17/18):

```<code>const AWS          = require('aws-sdk')
const AdmZip       = require('adm-zip')
const uuid         = require("uuid")

AWS.config = new AWS.Config();
AWS.config.accessKeyId = "...";
AWS.config.secretAccessKey = "....";
AWS.config.region = "us-west-2";

const lambda = new AWS.Lambda({apiVersion: '2015-03-31', region: 'us-west-2'})

// create function
//
const fragment = `const response = {
        statusCode: 200,
        body: JSON.stringify('Hello!'),
    };
    return response;`

const code = "exports.handler = async (event) => { " + fragment + "};"
const functionName = uuid.v4()
console.log("Creating function: " + functionName)

const zip = new AdmZip()
zip.addFile('index.js', Buffer.from(code))
const zippedBuffer = zip.toBuffer()

const params = {
    Code: { ZipFile: zippedBuffer },
    FunctionName: functionName,
    Handler: 'index.handler',
    Role: "...",
    Runtime: 'nodejs14.x',
    Description: 'user lambda function'
}

lambda.createFunction(params, function(err, data) {
    if (err) {
        console.error("Error from createFunction: " + err)
    } else {
        console.log("Lambda create function success!")

    setTimeout(() => {
        // invoke
        //
        const paramsInvoke = {
            FunctionName: functionName,
            InvocationType: "RequestResponse",
            Payload: JSON.stringify({key: "value"})
        }

        lambda.invoke(paramsInvoke).promise().then ((response) => {
            console.log("GOT RESPONSE: " + JSON.stringify(response))
        })
    }, 700) // exception if below 700ms
    }
})
</code>```

Body:
Getting ResourceConflictException while invoking the lambda function just created before. It used to work about a year or so ago but not it works ONLY if I add delay between create function and invoke function (at least 1 second). Any idea why invoke fails with message:

ResourceConflictException: The operation cannot be performed at this time. The function is currently in the following state: Pending

Here is the code snippet (tried client node versions 14/17/18):

const AWS          = require('aws-sdk')
const AdmZip       = require('adm-zip')
const uuid         = require("uuid")

AWS.config = new AWS.Config();
AWS.config.accessKeyId = "...";
AWS.config.secretAccessKey = "....";
AWS.config.region = "us-west-2";

const lambda = new AWS.Lambda({apiVersion: '2015-03-31', region: 'us-west-2'})

// create function
//
const fragment = `const response = {
        statusCode: 200,
        body: JSON.stringify('Hello!'),
    };
    return response;`

const code = "exports.handler = async (event) => { " + fragment + "};"
const functionName = uuid.v4()
console.log("Creating function: " + functionName)

const zip = new AdmZip()
zip.addFile('index.js', Buffer.from(code))
const zippedBuffer = zip.toBuffer()

const params = {
    Code: { ZipFile: zippedBuffer },
    FunctionName: functionName,
    Handler: 'index.handler',
    Role: "...",
    Runtime: 'nodejs14.x',
    Description: 'user lambda function'
}

lambda.createFunction(params, function(err, data) {
    if (err) {
        console.error("Error from createFunction: " + err)
    } else {
        console.log("Lambda create function success!")

    setTimeout(() => {
        // invoke
        //
        const paramsInvoke = {
            FunctionName: functionName,
            InvocationType: "RequestResponse",
            Payload: JSON.stringify({key: "value"})
        }

        lambda.invoke(paramsInvoke).promise().then ((response) => {
            console.log("GOT RESPONSE: " + JSON.stringify(response))
        })
    }, 700) // exception if below 700ms
    }
})


问:
SES - Autoreply on FROM address of verified domain
I have a SES verified domain example.com with a verified FROM my.example.com and we send emails with service@my.example.com.

If someone replies to service@my.example.com, they will get a 550 mailbox not found error. Is it possible to override this default error by some custom template? We want to inform our customers they should use another email address to reply to.


问:
What happens when a map is skipped when EPSG4326 is applied?
In order to create a system that uses GIS in the react-leaflet, it is created using CRS : EPSG4326.
Basically, EPSG4326 is making a map by skipping one by one.
I need an image with a map connected all the way. How can we solve this problem?
I beg you. After this part, you can no longer touch the map.


问:
How to dynamically align multiple buttons in the center of a constraint layout?
application code:

```<code>public static void mainButtonCreator(Context c, ConstraintLayout rootConstraintLayout,
                                     Button[] buttons, int[] colorCodes,
                                     ArrayList<String> buttonText) {

    GridLayout gridLayout = gridLayoutCreator(c);

    for (int i = 0; i < 4; i++) {
        String[] arrOfStr = buttonText.get(i).split("/", 2);

        ConstraintLayout constraintLayout = new ConstraintLayout(c);

        TextView textView = new TextView(c);
        textView.setGravity(Gravity.CENTER);
        String s = arrOfStr[0];
        textView.setText(s);
        textView.setTextColor(c.getResources().getColor(R.color.colorBlack));

        buttons[i] = new Button(c);
        buttons[i].setGravity(Gravity.CENTER);

        ConstraintLayout.LayoutParams params = new ConstraintLayout.LayoutParams(
                (int) c.getResources().getDimension(R.dimen.CreateView_mainButtonCreator_size),
                (int) c.getResources().getDimension(R.dimen.CreateView_mainButtonCreator_size));

        params.bottomToBottom = ConstraintSet.PARENT_ID;
        params.topToTop = ConstraintSet.PARENT_ID;
        params.startToStart = ConstraintSet.PARENT_ID;
        params.endToEnd = ConstraintSet.PARENT_ID;

        buttons[i].setTextSize(c.getResources().getDimension(R.dimen.CreateView_mainButtonCreator_textSize));
        String s1 = arrOfStr[1];
        buttons[i].setText(s1);
        buttons[i].setAllCaps(false);
        buttons[i].setLayoutParams(params);

        constraintLayout.addView(textView);
        constraintLayout.addView(buttons[i]);
        gridLayout.addView(constraintLayout);

    }

    buttonBackgroundSet(c, buttons, colorCodes);
    rootConstraintLayout.addView(gridLayout);

}
</code>```

I tested this code but it doesn't work:

```<code>        params.bottomToBottom = ConstraintSet.PARENT_ID;
        params.topToTop = ConstraintSet.PARENT_ID;
        params.startToStart = ConstraintSet.PARENT_ID;
        params.endToEnd = ConstraintSet.PARENT_ID;

</code>```

This image is the output of my Android Studio application. What code should I write so that the buttons are placed in the center of the device?

enter image description here

Body:
application code:

public static void mainButtonCreator(Context c, ConstraintLayout rootConstraintLayout,
                                     Button[] buttons, int[] colorCodes,
                                     ArrayList<String> buttonText) {

    GridLayout gridLayout = gridLayoutCreator(c);

    for (int i = 0; i < 4; i++) {
        String[] arrOfStr = buttonText.get(i).split("/", 2);

        ConstraintLayout constraintLayout = new ConstraintLayout(c);

        TextView textView = new TextView(c);
        textView.setGravity(Gravity.CENTER);
        String s = arrOfStr[0];
        textView.setText(s);
        textView.setTextColor(c.getResources().getColor(R.color.colorBlack));

        buttons[i] = new Button(c);
        buttons[i].setGravity(Gravity.CENTER);

        ConstraintLayout.LayoutParams params = new ConstraintLayout.LayoutParams(
                (int) c.getResources().getDimension(R.dimen.CreateView_mainButtonCreator_size),
                (int) c.getResources().getDimension(R.dimen.CreateView_mainButtonCreator_size));

        params.bottomToBottom = ConstraintSet.PARENT_ID;
        params.topToTop = ConstraintSet.PARENT_ID;
        params.startToStart = ConstraintSet.PARENT_ID;
        params.endToEnd = ConstraintSet.PARENT_ID;

        buttons[i].setTextSize(c.getResources().getDimension(R.dimen.CreateView_mainButtonCreator_textSize));
        String s1 = arrOfStr[1];
        buttons[i].setText(s1);
        buttons[i].setAllCaps(false);
        buttons[i].setLayoutParams(params);

        constraintLayout.addView(textView);
        constraintLayout.addView(buttons[i]);
        gridLayout.addView(constraintLayout);

    }

    buttonBackgroundSet(c, buttons, colorCodes);
    rootConstraintLayout.addView(gridLayout);

}

I tested this code but it doesn't work:

        params.bottomToBottom = ConstraintSet.PARENT_ID;
        params.topToTop = ConstraintSet.PARENT_ID;
        params.startToStart = ConstraintSet.PARENT_ID;
        params.endToEnd = ConstraintSet.PARENT_ID;

This image is the output of my Android Studio application. What code should I write so that the buttons are placed in the center of the device?

enter image description here


问:
Kill/unsubscribe previously running angular restservice when user go to other screens in UI
I have created the UI design shown below.

Consider that we have a screen called Reports where report ids are listed. We can click on each report and see the data after filtering the data by the given date.

UI design:
Filter screen
report data screen

Here we have one small dialog box opening when clicking on reportId lists, and then one more dialog box with report data after clicking on the view button in the filter dialog box.

API:
Filter scree -- seperarte Python API
View button screen – seperarte Python API

We are using the DJANGO REST Framework as an API, and it runs API methods parallax.

In the following case, there is a problem:
When the user clicks on the filter screen (the filter API will run in Django) and then clicks on the view button (the view button API will also run in Django), both the view button API and the current screen API are running in parallel in the backend, and each gives an API response to angular. As it responds to angular, even when the user is on another screen, the grid dialog box is open. How to restrict this

expecting an approach to sort out of this issue. whether it could be a django python API change or angular code change


问:
Oracle Micros Xstore Not Accepted Manual Authorization Codes For Checks
Oracle Micros Xstore Not Accepted Manual Authorization Codes For Checks

I am trying to setup check Tender and wants to enable Manual Authorization Process Button for Check Tender.
Xstore POS Version 21


问:
in my flutter app gradlew not giving signingReports what is reason after putting all the dependencies
```<code>* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.

     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.
</code>```

what is the problem even after getting the plugins right

Body:
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.

     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

what is the problem even after getting the plugins right


问:
How to add missing libraries of dart packages in file manager
In the directory, I found there was no libraries of the audioplayers in file manager(windows).
And I use android studio.

enter image description here

I tried to install pub dart(windows), nothing changed


问:
GCP PUB/SUB io.grpc.StatusException CANCELLED
We are getting below error for the gcp pub/sub subscription. What could be the cause here and in which case this method getting triggered.

io.grpc.Status.asException(Status.java:541)
at com.google.cloud.pubsub.v1.StreamingSubscriberConnection.doStop(StreamingSubscriberConnection.java:139)
at  com.google.api.core.AbstractApiService$InnerService.doStop(AbstractApiService.java:153)
at  com.google.common.util.concurrent.AbstractService.stopAsync(AbstractService.java:281)
at  com.google.api.core.AbstractApiService.stopAsync(AbstractApiService.java:129)
at  com.google.cloud.pubsub.v1.Subscriber.stopConnections(Subscriber.java:394)
at  com.google.cloud.pubsub.v1.Subscriber.stopAllStreamingConnections(Subscriber.java:367)
at  com.google.cloud.pubsub.v1.Subscriber.access$1700(Subscriber.java:93)
at  com.google.cloud.pubsub.v1.Subscriber$3.run(Subscriber.java:308)
at  java.base/java.lang.Thread.run(Thread.java:832)your text

As per pub/sub open api jar this method supposed to get triggered in case subscription is getting expired and its trying to clean.


问:
Report Builder with .Net Core and Reactjs
I am checking about Report builder in ReactJS and .Net 6 API.

I got https://www.npmjs.com/package/react-report-builder to build the reports

But in here they are mentioned API should be like https://peekdata.io/

Anybody have any idea about build the API like https://peekdata.io/developers/index.html#/ in .Net 6


问:
Relative Path is not working but absolute is working in java (Maven project structure)
I want to use relative path in my code but relative is not working for me but working on absolute path.
here my code(Utils.java

```<code>package org.example;

import org.example.model.Stats;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class Utils {
    private static final String FILE_PATH = "/home/project/Dummy/src/main/resources/data.csv";
    public  static List<Stats> readData() {
        List<Stats> StatsList = new ArrayList<>();
        try (BufferedReader br = new BufferedReader(
                new FileReader(FILE_PATH))
        ) {
            String line;
            while ((line = br.readLine()) != null) {
                String[] fields = line.split(",");

                Stats Stats = new Stats();

                Stats.setName(fields[0]);
                Stats.setAddress(fields[1]);
                Stats.setContact(fields[2]);
                Stats.setAbout(fields[3]);

                StatsList.add(Stats);
            }
        } catch (IOException e) {
            System.out.println("Error opening file: " + e.getMessage());
        }
        return StatsList;
    }
</code>```

In below i give the image of my project structure

Body:
I want to use relative path in my code but relative is not working for me but working on absolute path.
here my code(Utils.java

package org.example;

import org.example.model.Stats;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class Utils {
    private static final String FILE_PATH = "/home/project/Dummy/src/main/resources/data.csv";
    public  static List<Stats> readData() {
        List<Stats> StatsList = new ArrayList<>();
        try (BufferedReader br = new BufferedReader(
                new FileReader(FILE_PATH))
        ) {
            String line;
            while ((line = br.readLine()) != null) {
                String[] fields = line.split(",");

                Stats Stats = new Stats();

                Stats.setName(fields[0]);
                Stats.setAddress(fields[1]);
                Stats.setContact(fields[2]);
                Stats.setAbout(fields[3]);

                StatsList.add(Stats);
            }
        } catch (IOException e) {
            System.out.println("Error opening file: " + e.getMessage());
        }
        return StatsList;
    }

In below i give the image of my project structure


问:
TypeGraphQL: ArgumentValidationError on mutation
I'm playing around with TypeGraphQL and have a simple api setup to query projects and their associated clients.

For my createClient mutation, I'm receiving an ArgumentValidation Error, 'an unknown value was passed to the validate function' and can't pinpoint whats going wrong.

Client Schema

```<code>import { ObjectType, Field, ID } from "type-graphql";

@ObjectType()
class ClientSchema {
    @Field(type => ID)
    id: string

    @Field()
    name: string

    @Field()
    email: string

    @Field()
    phone: string
}

export default ClientSchema
</code>```

Client Resolver

```<code>import { Arg, Field, InputType, Mutation, Query, Resolver } from "type-graphql";

import exampleClients from "../utils/clients";
import ClientSchema from "../schemas/ClientsSchema";

@InputType()
class CreateClassInput {
    @Field()
    name: string

    @Field()
    email: string

    @Field()
    phone: string
}

@Resolver()
class ClientResolver {
  @Query((returns) => [ClientSchema])
  async clients() {
    return exampleClients;
  }

  @Query((returns) => ClientSchema)
  async client(@Arg("id") id: string) {
    const client = exampleClients.find((client) => client.id === id);

    if (!client) throw new Error("No such client");

    return client;
  }

  @Mutation((returns) => ClientSchema)
  async createClient(@Arg("data") createClassData: CreateClassInput) {
    const { name, email, phone } = createClassData;

    const newClient: ClientSchema = {
      id: String(exampleClients.length + 1),
      name,
      email,
      phone
    };

    exampleClients.push(newClient);

    return newClient;
  }
}

export default ClientResolver;
</code>```

GraphQL Query

```<code>mutation createClient {
  createClient(data: { name: "Test Name", email: "Test Email", phone: "Test phone" }) {
    name
  }
}
</code>```

If i pass the arguments to the mutation directly, without de-structuring an object, I don't get the error however with it I do. Is there something I'm doing wrong?

Body:
I'm playing around with TypeGraphQL and have a simple api setup to query projects and their associated clients.

For my createClient mutation, I'm receiving an ArgumentValidation Error, 'an unknown value was passed to the validate function' and can't pinpoint whats going wrong.

Client Schema

import { ObjectType, Field, ID } from "type-graphql";

@ObjectType()
class ClientSchema {
    @Field(type => ID)
    id: string

    @Field()
    name: string

    @Field()
    email: string

    @Field()
    phone: string
}

export default ClientSchema

Client Resolver

import { Arg, Field, InputType, Mutation, Query, Resolver } from "type-graphql";

import exampleClients from "../utils/clients";
import ClientSchema from "../schemas/ClientsSchema";

@InputType()
class CreateClassInput {
    @Field()
    name: string

    @Field()
    email: string

    @Field()
    phone: string
}

@Resolver()
class ClientResolver {
  @Query((returns) => [ClientSchema])
  async clients() {
    return exampleClients;
  }

  @Query((returns) => ClientSchema)
  async client(@Arg("id") id: string) {
    const client = exampleClients.find((client) => client.id === id);

    if (!client) throw new Error("No such client");

    return client;
  }

  @Mutation((returns) => ClientSchema)
  async createClient(@Arg("data") createClassData: CreateClassInput) {
    const { name, email, phone } = createClassData;

    const newClient: ClientSchema = {
      id: String(exampleClients.length + 1),
      name,
      email,
      phone
    };

    exampleClients.push(newClient);

    return newClient;
  }
}

export default ClientResolver;

GraphQL Query

mutation createClient {
  createClient(data: { name: "Test Name", email: "Test Email", phone: "Test phone" }) {
    name
  }
}

If i pass the arguments to the mutation directly, without de-structuring an object, I don't get the error however with it I do. Is there something I'm doing wrong?


问:
How to Remove degree (°N and °E) symbols in the levelplot axis
I am using the rasterVis package for visualizing gridded temperature data and while plotting my raster data layer using levelplot, degree North and degree East symbols appear in axis labels which I don't want to appear in my plot. Please give me ideas on how to get rid of them.
Below is the code I am using

```<code>library(raster)
library(ncdf4)
library(rasterVis)
data=stack("C:\\Users\\WKCTIA01\\Downloads\\adaptor.mars.internal-1672364228.5172331-3652-3-525a4eb6-3d38-4e31-a6a5-89ad76842ed9\\data.nc")
levelplot(data[[1]],margin=F,pretty=T,xlim=c(70,88),ylim=c(26,40))

</code>```

I searched alot but only got similar issue for ggplot but not for levelplot.

Body:
I am using the rasterVis package for visualizing gridded temperature data and while plotting my raster data layer using levelplot, degree North and degree East symbols appear in axis labels which I don't want to appear in my plot. Please give me ideas on how to get rid of them.
Below is the code I am using

library(raster)
library(ncdf4)
library(rasterVis)
data=stack("C:\\Users\\WKCTIA01\\Downloads\\adaptor.mars.internal-1672364228.5172331-3652-3-525a4eb6-3d38-4e31-a6a5-89ad76842ed9\\data.nc")
levelplot(data[[1]],margin=F,pretty=T,xlim=c(70,88),ylim=c(26,40))

I searched alot but only got similar issue for ggplot but not for levelplot.