问:
LiteRollingSwitch throws me back from the settings page to the welcome page
I used LiteRollingSwitch for a light-dark theme switch, it works but everytime I flip the switch it closes the settings page for no reason and gives me the welcome page then the dark/light theme appears.
I get nothing in the run and I am really stuck.

main.dart
`

```<code>void main() {
  runApp(
    MultiProvider(
      providers: [
        Provider(
          create: (_) => LoginService(),
        ),
        Provider(
          create: (_) => CategorySelectionService()
        )
      ],

      child: ChangeNotifierProvider(
        create: (context) => ThemeProvider(),
        builder: (context, _) {
          final themeProvider = Provider.of<ThemeProvider>(context);
          return MaterialApp(
              themeMode: themeProvider.themeMode,
              navigatorKey: Utils.mainAppNav,
              darkTheme: MyThemes.darkTheme,
              theme: MyThemes.lightTheme,
              //ThemeData(fontFamily: 'Roboto'),
              debugShowCheckedModeBanner: false,
              // home: settings(),
              initialRoute: '/',
              routes: {
                '/': (context) =>
                    SplashPage(goToPage: WelcomePage(), duration: 3),
                '/mainpage': (context) => MainPage(),
                '/selectedcategorypage': (context) => SelectedCategoryPage(),
                '/paginamaterii': (context) => Paginamaterii(),
                '/mappage': (context) => MapPage(),
                '/onboardingpage': (context) => OnBoardingPage(),
                '/gamespage' : (context) => GamesPage(),
                '/favoritespage' : (context) => Favoritspage(),
                '/settingspage' : (context) => settings()
              }
          );
        }
      ),
    )
  );
}
</code>```

`

The switch (ChangeThemeButton.dart)
`

```<code>class ChangeThemeButton extends StatefulWidget {
  const ChangeThemeButton({Key? key}) : super(key: key);

  @override
  State<ChangeThemeButton> createState() => _ChangeThemeButtonState();
}

class _ChangeThemeButtonState extends State<ChangeThemeButton> {
  @override
  Widget build(BuildContext context) {
    final themeProvider = Provider.of<ThemeProvider>(context);
    return Container(
      decoration: BoxDecoration(
        color: themeProvider.isDarkMode ? Colors.grey.shade800 : Colors.grey.shade200,
        borderRadius: BorderRadius.circular(25),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Padding(
            padding: const EdgeInsets.only(left: 25),
            child: Text('Light-Dark Theme',
              style: TextStyle(
                color: Theme.of(context).iconTheme.color,
                fontSize: 20,
              ),
            ),
          ),
          Transform.scale(
            scale: 0.8,
            child: LiteRollingSwitch(
              value: themeProvider.isDarkMode,
              textOn: 'On',
              textOff: 'Off',
              textOffColor: Colors.white,
              textOnColor: Colors.white,
              colorOn: Colors.grey.shade900,
              colorOff: Colors.grey,
              iconOn: Icons.nightlight_round,
              iconOff: Icons.sunny,
              animationDuration: Duration(milliseconds: 1),
              onTap: () {},
              onDoubleTap: () {},
              onSwipe: () {},
              onChanged: (value) {
                final provider = Provider.of<ThemeProvider>(context, listen: false);
                provider.toggleTheme(value);
              },
            ),
          ),
        ],
      ),
    );
  }
}
</code>```

settings.dart

```<code>class settings extends StatefulWidget {
  const settings({Key? key}) : super(key: key);

  @override
  State<settings> createState() => _settingsState();
}

class _settingsState extends State<settings> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MainAppBar(),
      body: Padding(
        padding: EdgeInsets.only(top: 15, right: 10, left: 10),
          child: ChangeThemeButton()
      ),
    );
  }
}
</code>```

`

I tried to change the settings page and the switch button from StatelessWidget to StatefulWidget

Body:
I used LiteRollingSwitch for a light-dark theme switch, it works but everytime I flip the switch it closes the settings page for no reason and gives me the welcome page then the dark/light theme appears.
I get nothing in the run and I am really stuck.

main.dart
`

void main() {
  runApp(
    MultiProvider(
      providers: [
        Provider(
          create: (_) => LoginService(),
        ),
        Provider(
          create: (_) => CategorySelectionService()
        )
      ],

      child: ChangeNotifierProvider(
        create: (context) => ThemeProvider(),
        builder: (context, _) {
          final themeProvider = Provider.of<ThemeProvider>(context);
          return MaterialApp(
              themeMode: themeProvider.themeMode,
              navigatorKey: Utils.mainAppNav,
              darkTheme: MyThemes.darkTheme,
              theme: MyThemes.lightTheme,
              //ThemeData(fontFamily: 'Roboto'),
              debugShowCheckedModeBanner: false,
              // home: settings(),
              initialRoute: '/',
              routes: {
                '/': (context) =>
                    SplashPage(goToPage: WelcomePage(), duration: 3),
                '/mainpage': (context) => MainPage(),
                '/selectedcategorypage': (context) => SelectedCategoryPage(),
                '/paginamaterii': (context) => Paginamaterii(),
                '/mappage': (context) => MapPage(),
                '/onboardingpage': (context) => OnBoardingPage(),
                '/gamespage' : (context) => GamesPage(),
                '/favoritespage' : (context) => Favoritspage(),
                '/settingspage' : (context) => settings()
              }
          );
        }
      ),
    )
  );
}

`

The switch (ChangeThemeButton.dart)
`

class ChangeThemeButton extends StatefulWidget {
  const ChangeThemeButton({Key? key}) : super(key: key);

  @override
  State<ChangeThemeButton> createState() => _ChangeThemeButtonState();
}

class _ChangeThemeButtonState extends State<ChangeThemeButton> {
  @override
  Widget build(BuildContext context) {
    final themeProvider = Provider.of<ThemeProvider>(context);
    return Container(
      decoration: BoxDecoration(
        color: themeProvider.isDarkMode ? Colors.grey.shade800 : Colors.grey.shade200,
        borderRadius: BorderRadius.circular(25),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Padding(
            padding: const EdgeInsets.only(left: 25),
            child: Text('Light-Dark Theme',
              style: TextStyle(
                color: Theme.of(context).iconTheme.color,
                fontSize: 20,
              ),
            ),
          ),
          Transform.scale(
            scale: 0.8,
            child: LiteRollingSwitch(
              value: themeProvider.isDarkMode,
              textOn: 'On',
              textOff: 'Off',
              textOffColor: Colors.white,
              textOnColor: Colors.white,
              colorOn: Colors.grey.shade900,
              colorOff: Colors.grey,
              iconOn: Icons.nightlight_round,
              iconOff: Icons.sunny,
              animationDuration: Duration(milliseconds: 1),
              onTap: () {},
              onDoubleTap: () {},
              onSwipe: () {},
              onChanged: (value) {
                final provider = Provider.of<ThemeProvider>(context, listen: false);
                provider.toggleTheme(value);
              },
            ),
          ),
        ],
      ),
    );
  }
}

settings.dart

class settings extends StatefulWidget {
  const settings({Key? key}) : super(key: key);

  @override
  State<settings> createState() => _settingsState();
}

class _settingsState extends State<settings> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MainAppBar(),
      body: Padding(
        padding: EdgeInsets.only(top: 15, right: 10, left: 10),
          child: ChangeThemeButton()
      ),
    );
  }
}

`

I tried to change the settings page and the switch button from StatelessWidget to StatefulWidget


来源: stackexchange

问:
Forward slash in netmiko_send_command and netmiko_send_config gives syntax error
In my paloalto panos , when i try to send command "show interface ethernet 1/1" it gives me syntax error. Other commands without forward slashes however work. No its not a configuration mode issue as I have made sure i am in the correct configuration mode. The command also works when i configure it through paltoalto system directly. What am I missing here? Is there any special way I need to send the command?

The code i used is a simple sample code but here it is anyway:

```<code>output = nr.run(
    task=netmiko_send_config,
    config_commands=["exit", "show interface ethernet 1/1"]
        )

print_title("DEPLOYING AUTOMATED BASELINE CONFIGURATIONS")
print_result(output)
</code>```

ContentLicense: CC BY-SA 4.0

Body:
In my paloalto panos , when i try to send command "show interface ethernet 1/1" it gives me syntax error. Other commands without forward slashes however work. No its not a configuration mode issue as I have made sure i am in the correct configuration mode. The command also works when i configure it through paltoalto system directly. What am I missing here? Is there any special way I need to send the command?

The code i used is a simple sample code but here it is anyway:

output = nr.run(
    task=netmiko_send_config,
    config_commands=["exit", "show interface ethernet 1/1"]
        )

print_title("DEPLOYING AUTOMATED BASELINE CONFIGURATIONS")
print_result(output)


问:
How to store jest-html-reporters reports in different directories based on testMatch
This is how my jest.config looks like.

```<code>const filename = process.argv[2]?.toString()?.split('/')?.pop()?.split('.')?.[0];
const summaryTitle = filename.substring(4, filename.length).replace('_', ' ') + ' Test';
module.exports = {
    ...jestConfig,
    testMatch: ['**/input-tests/*.test.js', '**/accountMatching-tests/*.test.js'],
    reporters: [
        'default',
        [
            'jest-html-reporters',
            {
                publicPath: 'unitTests/input-test-report',
                filename: filename + '_report.html',
                openReport: false,
                enableMergeData: true,
                inlineSource: true
            }
        ],
        [
            "./node_modules/jest-html-reporter",
            {
                "pageTitle": summaryTitle,
                "includeFailureMsg": false,
                "outputPath": "unitTests/Final-input-Report.html",
                "useCssFile": false,
                "append": true
            }
        ]
    ]
};

</code>```

Right now I get all reports in one folder, I am trying to store the input-tests reports and accountMatching-tests reports in a different folder. Is there a way to achieve this in jest?

I tried to search for this on jest-html-reporters-npm but unfortunately only public path was available there as well.

Body:
This is how my jest.config looks like.

const filename = process.argv[2]?.toString()?.split('/')?.pop()?.split('.')?.[0];
const summaryTitle = filename.substring(4, filename.length).replace('_', ' ') + ' Test';
module.exports = {
    ...jestConfig,
    testMatch: ['**/input-tests/*.test.js', '**/accountMatching-tests/*.test.js'],
    reporters: [
        'default',
        [
            'jest-html-reporters',
            {
                publicPath: 'unitTests/input-test-report',
                filename: filename + '_report.html',
                openReport: false,
                enableMergeData: true,
                inlineSource: true
            }
        ],
        [
            "./node_modules/jest-html-reporter",
            {
                "pageTitle": summaryTitle,
                "includeFailureMsg": false,
                "outputPath": "unitTests/Final-input-Report.html",
                "useCssFile": false,
                "append": true
            }
        ]
    ]
};

Right now I get all reports in one folder, I am trying to store the input-tests reports and accountMatching-tests reports in a different folder. Is there a way to achieve this in jest?

I tried to search for this on jest-html-reporters-npm but unfortunately only public path was available there as well.


问:
Changing HttpMessageHandler to NSUrlSessionHandler leads to Required request body is missing error on server
On Xamarin.Forms project, changed HttpMessageHandler to NSUrlSessionHandler inside HttpClient(ios). Immediately after release in AppStore, sometimes server started to track error: 'Required request body is missing'. Body for these requests verified before SendAsync, so can't be null, also Android doesn't faced with something similar. Does anybody faced with NSUrlSessionHandler issue, looks like sometimes it set body to null?</p>


问:
Airflow Shared folder ownerships
I have mistakenly changed the ownership of /shared folder using chown airflow:airflow -R /shared/ After this operation the Airflow is showing error as [DAG Import Errors (10)]). There are three linux ec2 machines for Airflow

I reverted the ownership of folders inside /shared since I have taken the screenshot, but still the error is available. Since I have changed ownership with -R all the folder and files inside the /shared directory have airflow permission. Is it possible to revert back the permission or what is the correct permission we need to provide for the files and folder in /shared directory.

Any help on this is much appreciated

Title: Airflow Shared folder ownerships


问:
Does facebook meta pixel not work inside a react-native webview by itself?
Just like what is stated, do I need to compulsorily add app events to record website interaction via webview on facebook events manager

I have tried looking up this article


问:
launchctl bootstrap gui/501 shows "bad ownership/permissions" (but user/501 works)
I'm on Mac Ventura 13.1, I moved my home dir to an external drive as the internal SSD is unusably small (256GB). I followed this guide: https://www.lifewire.com/move-macs-home-folder-new-location-2260157

Everything appears to be working correctly except for services. When I try to start I see this:

```<code>$ echo $HOME
/Volumes/Data/home/hackeron
$ /bin/launchctl bootstrap gui/501 /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
</code>```

When I try to run as root I see:

```<code>$ sudo /bin/launchctl bootstrap gui/501 /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist

/Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist: Path had bad ownership/permissions
Bootstrap failed: 122: Path had bad ownership/permissions
</code>```

But the path ownership/permissions appear correct:

```<code>$ ls -ltra /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist
-rw-r--r--@ 1 hackeron  staff  726 23 Dec 11:02 /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist
$ /bin/ls -ltra /Volumes/Data/home/hackeron/Library | grep LaunchAg
drwxr-xr-x   11 hackeron  staff    352 23 Dec 11:05 LaunchAgents
$ ls -ltra /Volumes/Data/home/hackeron | grep Library
drwx------@ 97 hackeron  staff       3104 21 Dec 20:52 Library
</code>```

I also tried to chmod 600 the service file but the results are the same.

This happens with all service files in the home directory, not just memcached. Running the mamcache command manually starts memcache without issues, so it is not an issue with the service/executable (it was also working before moving the home directory):

```<code>$ /opt/homebrew/opt/memcached/bin/memcached -l localhost
</code>```

I also found this in /var/log/com.apple.xpc.launchd/launchd.log - this is when running launchctl bootstrap as the user:

```<code>2022-12-23 12:11:07.908091 (gui/501 [100003]) <Notice>: entering bootstrap mode
2022-12-23 12:11:07.908359 (gui/501/homebrew.mxcl.memcached) <Error>: Caller specified a plist with bad ownership/permissions: path = /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist, caller = launchctl[14134]
2022-12-23 12:11:07.908376 (gui/501 [100003]) <Notice>: Bootstrap by launchctl[14134] for /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist failed (122: Path had bad ownership/permissions)
2022-12-23 12:11:07.908386 (gui/501 [100003]) <Notice>: exiting bootstrap mode
</code>```

Strangly, if I replace gui/501 with user/501 it works, looking at this page: https://gist.github.com/masklinn/a532dfe55bdeab3d60ab8e46ccc38a68 - it appears the system thinks I am not logged in? - but I am logged in and using the Mac as normal (locally with a mouse/keyboard/monitor, not remote):

```<code>$ whoami
hackeron
$ echo $UID
501
$ launchctl managername
Aqua
</code>```

Any ideas?

Body:
I'm on Mac Ventura 13.1, I moved my home dir to an external drive as the internal SSD is unusably small (256GB). I followed this guide: https://www.lifewire.com/move-macs-home-folder-new-location-2260157

Everything appears to be working correctly except for services. When I try to start I see this:

$ echo $HOME
/Volumes/Data/home/hackeron
$ /bin/launchctl bootstrap gui/501 /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.

When I try to run as root I see:

$ sudo /bin/launchctl bootstrap gui/501 /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist

/Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist: Path had bad ownership/permissions
Bootstrap failed: 122: Path had bad ownership/permissions

But the path ownership/permissions appear correct:

$ ls -ltra /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist
-rw-r--r--@ 1 hackeron  staff  726 23 Dec 11:02 /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist
$ /bin/ls -ltra /Volumes/Data/home/hackeron/Library | grep LaunchAg
drwxr-xr-x   11 hackeron  staff    352 23 Dec 11:05 LaunchAgents
$ ls -ltra /Volumes/Data/home/hackeron | grep Library
drwx------@ 97 hackeron  staff       3104 21 Dec 20:52 Library

I also tried to chmod 600 the service file but the results are the same.

This happens with all service files in the home directory, not just memcached. Running the mamcache command manually starts memcache without issues, so it is not an issue with the service/executable (it was also working before moving the home directory):

$ /opt/homebrew/opt/memcached/bin/memcached -l localhost

I also found this in /var/log/com.apple.xpc.launchd/launchd.log - this is when running launchctl bootstrap as the user:

2022-12-23 12:11:07.908091 (gui/501 [100003]) <Notice>: entering bootstrap mode
2022-12-23 12:11:07.908359 (gui/501/homebrew.mxcl.memcached) <Error>: Caller specified a plist with bad ownership/permissions: path = /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist, caller = launchctl[14134]
2022-12-23 12:11:07.908376 (gui/501 [100003]) <Notice>: Bootstrap by launchctl[14134] for /Volumes/Data/home/hackeron/Library/LaunchAgents/homebrew.mxcl.memcached.plist failed (122: Path had bad ownership/permissions)
2022-12-23 12:11:07.908386 (gui/501 [100003]) <Notice>: exiting bootstrap mode

Strangly, if I replace gui/501 with user/501 it works, looking at this page: https://gist.github.com/masklinn/a532dfe55bdeab3d60ab8e46ccc38a68 - it appears the system thinks I am not logged in? - but I am logged in and using the Mac as normal (locally with a mouse/keyboard/monitor, not remote):

$ whoami
hackeron
$ echo $UID
501
$ launchctl managername
Aqua

Any ideas?


问:
How to force VS Code to provide hints in Python when there is a syntax error?
Any sort of syntax error near the cursor causes the VS Code Python extension to stop providing hints:

Here, I'm ready to type the closing parenthesis as soon as I'm done typing the variable name, which the editor refuses to help with.

How can I stop this exasperating behavior?


问:
can we create spring cloud multiple gateways in case of failure of one instance
I have multiple instances of eureka servers but i want to create multiple instances of gateways also to manage fault tolerance.
Can we create spring cloud multiple gateways in case of failure of one instance.

I try to create multiple instances of gateways.


问:
Impossible to pip install pysphinx
I am trying to use Pysphynx to run the following speech-to-text transcription code. It seems that there is just no way to install pysphinx, I get the standard error message:
ERROR: Could not find a version that satisfies the requirement pysphynx (from versions: none)

and I did not find any guidance on internet. What would you advise me? (I installed, beforehand, other packages such as pocketsphinx) Is pysphinx obsolete?

```<code>pip install pysphinx
import pysphinx

# Create a SpeechRecognizer object
recognizer = pysphinx.SpeechRecognizer(language='fr-FR')

# Load the audio file
audio_file = output_path
audio = pysphinx.AudioFile(audio_file)

# Transcribe the audio into text
text = recognizer.transcribe(audio)

# Print the transcribed text
print(text)

with open('transcription.txt', 'w') as f:
    f.write(text)
</code>```

I installed, beforehand, other packages such as pocketsphinx. I have tried to run the code on colab jupyternotebook. I have tried pip install --find-links https://pypi.org/simple pysphinx . The same issue arises each time.

Title: Impossible to pip install pysphinx

Body:
I am trying to use Pysphynx to run the following speech-to-text transcription code. It seems that there is just no way to install pysphinx, I get the standard error message:
ERROR: Could not find a version that satisfies the requirement pysphynx (from versions: none)

and I did not find any guidance on internet. What would you advise me? (I installed, beforehand, other packages such as pocketsphinx) Is pysphinx obsolete?

pip install pysphinx
import pysphinx

# Create a SpeechRecognizer object
recognizer = pysphinx.SpeechRecognizer(language='fr-FR')

# Load the audio file
audio_file = output_path
audio = pysphinx.AudioFile(audio_file)

# Transcribe the audio into text
text = recognizer.transcribe(audio)

# Print the transcribed text
print(text)

with open('transcription.txt', 'w') as f:
    f.write(text)

I installed, beforehand, other packages such as pocketsphinx. I have tried to run the code on colab jupyternotebook. I have tried pip install --find-links https://pypi.org/simple pysphinx . The same issue arises each time.


问:
Is is considered bad code practice to put code into __init__.py?
Most of the __ init__.py of a project I work on (python 3.7) are empty but some have code in it.

I am in charge of refactoring.

Should I move the code out of the __ init__.pys as much as possible ?


问:
NPM - Running npm i shows every single log in Source Control
Yesterday I was running into some issues with npm, namely a "can't find package.json file error. After some digging around, I ran

```<code>npm config set cache "C:\Users\(username)\AppData\Roaming\npm-cache" --global
</code>```

which in the end didn't solve the issue, and now whenever I run a npm command in the terminal, git logs every single file in Source Control

So far, I've tried reinstalling node with different versions (14.15, 16.0) and deleting node-modules and running npm install again but to no avail. How can I fix this issue?

Body:
Yesterday I was running into some issues with npm, namely a "can't find package.json file error. After some digging around, I ran

npm config set cache "C:\Users\(username)\AppData\Roaming\npm-cache" --global

which in the end didn't solve the issue, and now whenever I run a npm command in the terminal, git logs every single file in Source Control

So far, I've tried reinstalling node with different versions (14.15, 16.0) and deleting node-modules and running npm install again but to no avail. How can I fix this issue?


问:
Is it possible to enable long touch support in goodix touchscreen in linux?
Im using imx6q hardware with Goodix touchscreen. I have an application running on this touchscreen.
The UI has a button which should be pressed for long time to increase the volume gradually.
If I run this application on touchscreen PC it works fine.
But on goodix touch screen it only captures an event of single press and release even though pressed for long time.

cat /dev/input/even0 | hexdump -c

Command gives single event log for key press and key release but doesnt show anything for long touch.
Is there any way to enable long touch support from /proc or from drivers itself?

I tried to look into the goodix driver and ref manual as well but couldnt find anything.
Also, tried to change values into /sys/devices/platform/soc/2100000.bus/21a0000.i2c/i2c-0/0-005d/.

These are the details of touchscreen.


问:
plot_covariate_groups does not work with feature in strats
I built the Cox Proportional Hazard model with strata features.

I needed information about the feature in strata. For this I used plot_partial_effects_on_outcome() or plot_covariate_groups(), but theres an error, that this feature is not in original dataset, but it's not true. Original dataset (data_strata) in my case HAS this feature ('Partner').

What I am doing wrong? How can I find information about feature in strata?

```<code>strata = ['Partner','OnlineSecurity', 'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV', 'StreamingMovies', 'Contract', 'TotalCharges_strata', 'InternetServiceFunctions_strata']
cph.fit(data_strata,"tenure",event_col="Churn", strata = strata)
cph.plot_covariate_groups('Partner', values=[0, 1])
</code>```
```<code>KeyError: 'covariate `Partner` is not present in the original dataset'
</code>```

I expected the graphs with differents values of my feature and curves based in this value.

I checked columns in original dataset and unique values:

```<code>data_strata.columns
</code>```
```<code>Index(['gender', 'SeniorCitizen', 'Partner', 'Dependents', 'tenure',
       'PhoneService', 'MultipleLines', 'InternetService', 'OnlineSecurity',
       'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV',
       'StreamingMovies', 'Contract', 'PaperlessBilling', 'PaymentMethod',
       'MonthlyCharges', 'Churn', 'TotalCharges_strata',
       'InternetServiceFunctions_strata'],
      dtype='object')
</code>```
```<code>data_strata['Partner'].unique()
</code>```
```<code>array([1, 0])
</code>```

What's wrong?

Body:
I built the Cox Proportional Hazard model with strata features.

I needed information about the feature in strata. For this I used plot_partial_effects_on_outcome() or plot_covariate_groups(), but theres an error, that this feature is not in original dataset, but it's not true. Original dataset (data_strata) in my case HAS this feature ('Partner').

What I am doing wrong? How can I find information about feature in strata?

strata = ['Partner','OnlineSecurity', 'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV', 'StreamingMovies', 'Contract', 'TotalCharges_strata', 'InternetServiceFunctions_strata']
cph.fit(data_strata,"tenure",event_col="Churn", strata = strata)
cph.plot_covariate_groups('Partner', values=[0, 1])

KeyError: 'covariate `Partner` is not present in the original dataset'

I expected the graphs with differents values of my feature and curves based in this value.

I checked columns in original dataset and unique values:

data_strata.columns

Index(['gender', 'SeniorCitizen', 'Partner', 'Dependents', 'tenure',
       'PhoneService', 'MultipleLines', 'InternetService', 'OnlineSecurity',
       'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV',
       'StreamingMovies', 'Contract', 'PaperlessBilling', 'PaymentMethod',
       'MonthlyCharges', 'Churn', 'TotalCharges_strata',
       'InternetServiceFunctions_strata'],
      dtype='object')

data_strata['Partner'].unique()

array([1, 0])

What's wrong?


问:
PDFLib.Objects library giving encoding issues on the pdf generated
While using PDFLib.Objects library to generate templates could observe some character encoding issues .

Example :Boétie is getting converted to BoÃ©tie.

Please be informed the application is in .net.
Could anyone  please help acheiving it ?

Expecting Boétie with special character being present but it’s getting converted into ascii.


问:
what do block/inline do inside non-flow layouts?
CSS beginner here, so I might be misunderstanding...

From what I understand, an element has

an outer display value: block/inline

an inner display value: flow, grid, flex (and a few others)

If the parents inner display is "flow", the childrens' outer display determines how they are laid out inside the parent. But what happens if the parent element inner layout is not flow?? What do the children outer values do in that case?? Is there any resource describing in detail how the parent's inner display interacts with the children's outer display in general??


问:
How to select the nth instance of an identical element
Im trying to locate the nth instance of a element which appears multiple times on a page.

The attached image shows the selector string im using to locate them along with the first three elements detected in the dom

Ive tried using :nth-of-type() to narrow down my search to a single instance but this does not work. For instance it I try to locate the third instance, none of the results are returned

If I search for the fist instance get back all 6 instances on the page

Is there a way to locate a specific instance of the 6 returned in the list?

I looked into trying a similar approach using nth child but this did no work as a think its due to the way the elements are not in a parent-child structure.

Does anyone know how to acheive what im trying to do?
p.s im not able to use the id as this updates dynamically every time the page is refreshed hence is not a reliable identifiers


问:
An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll Additional information:
Hello I am getting error,
An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll

Additional information: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required.

I have code in console application for email:

``

```<code>`In asp console application:

 internal class Program
    {
        static void Main(string[] args)
        {
            string FromMail = "applitech.infotech.itsolution@gmail.com";
            string Password = "officeuser#";
            MailMessage m = new MailMessage();

            m.From = new MailAddress(FromMail);
            m.Subject = "tEST";
            m.To.Add(new MailAddress("sumitranandanbgp96@gmail.com"));
            m.Body = "This is body";
            m.IsBodyHtml = true;

            var smtpClient = new SmtpClient("smtp.gmail.com")
            {
                Port = 587,
                Credentials = new NetworkCredential(FromMail, Password),
                EnableSsl = true
                //UseDefaultCredentials = false
            };
            smtpClient.Send(m);
            Console.WriteLine("completed");

        }
    }
</code>```

please help me.

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

Body:
Hello I am getting error,
An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll

Additional information: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required.

I have code in console application for email:

``

`In asp console application:

 internal class Program
    {
        static void Main(string[] args)
        {
            string FromMail = "applitech.infotech.itsolution@gmail.com";
            string Password = "officeuser#";
            MailMessage m = new MailMessage();

            m.From = new MailAddress(FromMail);
            m.Subject = "tEST";
            m.To.Add(new MailAddress("sumitranandanbgp96@gmail.com"));
            m.Body = "This is body";
            m.IsBodyHtml = true;

            var smtpClient = new SmtpClient("smtp.gmail.com")
            {
                Port = 587,
                Credentials = new NetworkCredential(FromMail, Password),
                EnableSsl = true
                //UseDefaultCredentials = false
            };
            smtpClient.Send(m);
            Console.WriteLine("completed");

        }
    }

please help me.


问:
How to retrieve a list of profiles/companies that a user is admin to in LinkedIn
I have an authorization token from a user. I'd like to know what profiles he is ADMIN of in order to get the ad data from the profiles. Viewing LI documentation doesn't help. A SO question: How to fetch admin profile details of a company page using Company API - Linkedin fill the bill but unfortunately LI API changed and it is now currently working.
Any ideas?

Old API does not work.
The endpoint "/v2/people/{memberId}" returns
"{'serviceErrorCode': 100, 'message': 'Unpermitted fields present in RESOURCE_KEY: Data Processing Exception while processing fields [/memberId]', 'status': 403}"

```<code>def get_profile_info(token: str, profile_id: str) -> str:
    url = 'https://api.linkedin.com/v2/people/' + profile_id
    headers = {'Authorization': f'Bearer {token}'}

    response = requests.get(url, headers=headers).json()

    return response
</code>```

Body:
I have an authorization token from a user. I'd like to know what profiles he is ADMIN of in order to get the ad data from the profiles. Viewing LI documentation doesn't help. A SO question: How to fetch admin profile details of a company page using Company API - Linkedin fill the bill but unfortunately LI API changed and it is now currently working.
Any ideas?

Old API does not work.
The endpoint "/v2/people/{memberId}" returns
"{'serviceErrorCode': 100, 'message': 'Unpermitted fields present in RESOURCE_KEY: Data Processing Exception while processing fields [/memberId]', 'status': 403}"

def get_profile_info(token: str, profile_id: str) -> str:
    url = 'https://api.linkedin.com/v2/people/' + profile_id
    headers = {'Authorization': f'Bearer {token}'}

    response = requests.get(url, headers=headers).json()

    return response


问:
Send Mail when string in logfile is found (only once per entry)
i try to analyze which customers come over google ads on an product in my webshop.
I think there is a competitor which clicks on these ad to reduce my daily budget.

I have a little script which sends me an e-mail when the string is founded in the active access_log from apache.
The problem is now, when i execute these script with cronjob (5 min) i get everytime an e-mail with already founded strings and "old" entry. I only want to get an e-mail when there is founded a new entry.

These script send me an e-mail when the string is founded in logfile:
body="$(grep 'GET /shop/product?traffic=ads' /var/www/vhosts/domain.de/logs/access_ssl_log)" && echo "$body" | mailx -s subject info@domain.de

I need only an e-mail when there is founded a new entry.

These is a result from the mail:
80.187.125.xxx - - [23/Dec/2022:07:53:36 +0100] "GET /shop/product?traffic=ads&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE HTTP/1.0" 200 12902 "https://www.google.com/" "Mozilla/5.0 (Linux; Android 12; SM-M317F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36" 80.187.125.xxx - - [23/Dec/2022:07:53:39 +0100] "GET /shop/product?traffic=ads&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE&cpnb_method=cpnbCookiesAccepted&dt=1671778418430 HTTP/1.0" 303 1162 "https://www.domain.de/shop/product?traffic=ads&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE" "Mozilla/5.0 (Linux; Android 12; SM-M317F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36" 80.187.125.xxx - - [23/Dec/2022:07:53:40 +0100] "GET /shop/product?traffic=ads&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE&dt=1671778418430 HTTP/1.0" 200 12825 "https://www.domain.de/shop/product?traffic=ads&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE" "Mozilla/5.0 (Linux; Android 12; SM-M317F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36" 80.187.125.xxx - - [23/Dec/2022:07:53:52 +0100] "GET /shop/product?traffic=ads&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE&gclid=CjwKCAiAnZCdBhBmEiwA8nDQxWHlsUKiIit8p-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-SRoCqTcQAvD_BwE HTTP/1.0" 200 12825 "https://www.google.com/" "Mozilla/5.0 (Linux; Android 12; SM-M317F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36" 178.200.16.xxx - - [23/Dec/2022:11:59:33 +0100] "GET /shop/product?traffic=adsgclid=tPdadssAsddfeefdssdsd-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6QxxxxxTcQAvD_BwE&gclid=xxxx-RkkxwcOa0qrMUp9Gd2zYdp-8SKcPqbxdc6Qqt-xxxx HTTP/1.0" 200 12826 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"

We see that two customers clicks to the ad. Maybe we can write every founded string into a second logfile and delete the "old" entry in live-logfile?


问:
Why does my docker bind mount shows some error and does not load port?
I am going through a tutorial on docker and I came across this while I am trying it on my own(Actually I am following the same examples as it is in tutorial) the guide uses MacOs while I use Windows.

Following are the files

Docker-file:

```<code>FROM node:14

WORKDIR /app

COPY package.json /app

RUN npm install

COPY . /app

EXPOSE 80

CMD ["node", "server.js"]

</code>```

Folder structure

Tool used -VS code

image name= feedback-node

container name: feedback-container

volume name: feedback-volume

project file path :

```<code>E:\downloads\Compressed\data-volumes-01-starting-setup>
</code>```

while creating the container with the named volume I am getting the following output

Terminal command used:

```<code>PS E:\downloads\Compressed\data-volumes-01-starting-setup> docker run -d -p 3000:80 --name feedback-container -v feedback-volume:/app/feedback  feedback-node
</code>```
```<code>PS E:\downloads\Compressed\data-volumes-01-starting-setup> docker run -d -p 3000:80 --name feedback-container -v feedback-volume:/app/feedback  feedback-node
c6476ae44c400e802d6e26f87021507f0c5184cf34e6ecccddbc05d4c878ab6c
PS E:\downloads\Compressed\data-volumes-01-starting-setup>
</code>```

I am having trouble with bind mount I find  that the output is not produced in the server

Terminal command used:

```<code>PS E:\downloads\Compressed\data-volumes-01-starting-setup> docker run -d -p 3000:80 --name feedback-container -v feedback:/app/feedback -v E:\downloads\Compressed\data-volumes-01-starting-setup:/app  feedback-node
</code>```

while running docker logs following output displayed

When I do named-volume the program gets executed whereas when I do BINDMOUNT and refresh the port it says the Site cant be reached if you see the docker logs details (picture attached) it says "Cannot find module express".

Body:
I am going through a tutorial on docker and I came across this while I am trying it on my own(Actually I am following the same examples as it is in tutorial) the guide uses MacOs while I use Windows.

Following are the files

Docker-file:

FROM node:14

WORKDIR /app

COPY package.json /app

RUN npm install

COPY . /app

EXPOSE 80

CMD ["node", "server.js"]

Folder structure

Tool used -VS code

image name= feedback-node

container name: feedback-container

volume name: feedback-volume

project file path :

E:\downloads\Compressed\data-volumes-01-starting-setup>

while creating the container with the named volume I am getting the following output

Terminal command used:

PS E:\downloads\Compressed\data-volumes-01-starting-setup> docker run -d -p 3000:80 --name feedback-container -v feedback-volume:/app/feedback  feedback-node

PS E:\downloads\Compressed\data-volumes-01-starting-setup> docker run -d -p 3000:80 --name feedback-container -v feedback-volume:/app/feedback  feedback-node
c6476ae44c400e802d6e26f87021507f0c5184cf34e6ecccddbc05d4c878ab6c
PS E:\downloads\Compressed\data-volumes-01-starting-setup>

I am having trouble with bind mount I find  that the output is not produced in the server

Terminal command used:

PS E:\downloads\Compressed\data-volumes-01-starting-setup> docker run -d -p 3000:80 --name feedback-container -v feedback:/app/feedback -v E:\downloads\Compressed\data-volumes-01-starting-setup:/app  feedback-node

while running docker logs following output displayed

When I do named-volume the program gets executed whereas when I do BINDMOUNT and refresh the port it says the Site cant be reached if you see the docker logs details (picture attached) it says "Cannot find module express".


问:
How to create a python tcp server inside a docker container
I have developed a python tcp server and assign the 5511 port number to it.
When I run it simply with "python3 server.py" its OK and server waits for connections.
But if I put it inside a container and run this command as docker command, I receive the "Cannot assign this port number" error"

My docker file

```<code>FROM python:3.10

WORKDIR /project

COPY . .

EXPOSE 5511

CMD ["python3", "server.py"]
</code>```

I have try Exposing the port or port mapping but it does not work

Body:
I have developed a python tcp server and assign the 5511 port number to it.
When I run it simply with "python3 server.py" its OK and server waits for connections.
But if I put it inside a container and run this command as docker command, I receive the "Cannot assign this port number" error"

My docker file

FROM python:3.10

WORKDIR /project

COPY . .

EXPOSE 5511

CMD ["python3", "server.py"]

I have try Exposing the port or port mapping but it does not work


问:
how to change only a specific element of a list of lists
I created a 2 'dimensional' list where each element is None.

```<code>listA = [[None] * 8 ] *8
</code>```

by logic I thought I could access each element individually by choosing between 2 coordinates the horizontal and the vertical one.

```<code>listA[y][x]
</code>```

but I ran into a problem that I can't explain and I would need help the problem is as follows.

We agree that:

```<code>[[None] * 8 ] *8 == [[None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None]]
</code>```

The python interpreter returns True.

So if I make :

```<code>  ListA = [[None] * 8 ] *8
</code>```

And

```<code> ListaB = [[None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None]]
</code>```

And after I edit the element in the same position in both lists I will get the same result right ?

```<code>ListA[0][0]= 3
ListaB[0][0]= 3
</code>```

But strangely at this point the two lists are different :

```<code>ListA == ListB
</code>```

return False

print(ListA) = `

```<code>[[3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None]]`
</code>```

print(ListB) =

```<code>[[3, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None]]
</code>```

I cannot logically understand why.

to me it look like Python remeber the way listA was constructed and use the same process to update it, if so I am beginning to think that python does not evaluate the expression to be assigned to a variable but assigns the expression to a varible which is quite equivocal  if you ask me.

Body:
I created a 2 'dimensional' list where each element is None.

listA = [[None] * 8 ] *8

by logic I thought I could access each element individually by choosing between 2 coordinates the horizontal and the vertical one.

listA[y][x]

but I ran into a problem that I can't explain and I would need help the problem is as follows.

We agree that:

[[None] * 8 ] *8 == [[None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None],
                     [None, None, None, None, None, None, None, None]]

The python interpreter returns True.

So if I make :

  ListA = [[None] * 8 ] *8

And

 ListaB = [[None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None],
              [None, None, None, None, None, None, None, None]]

And after I edit the element in the same position in both lists I will get the same result right ?

ListA[0][0]= 3
ListaB[0][0]= 3

But strangely at this point the two lists are different :

ListA == ListB

return False

print(ListA) = `

[[3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None],
                 [3, None, None, None, None, None, None, None]]`

print(ListB) =

[[3, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None],
               [None, None, None, None, None, None, None, None]]

I cannot logically understand why.

to me it look like Python remeber the way listA was constructed and use the same process to update it, if so I am beginning to think that python does not evaluate the expression to be assigned to a variable but assigns the expression to a varible which is quite equivocal  if you ask me.


问:
Who's generating this JSON Catalog files, and can I put them under git ignore?
On an existing application, I see that each time I build a file of this type is generated

I've still not understood who's generating it and if I can put this folder under git ignore...

I use Resharper and VS 2022 Pro, but I don't think it's generating them... any suggestions?

Thanks


问:
ServerHttpRequest.getCookies() is null
I have a quick question regarding ServerHTTP Request.

So I am sending a request from Postman to my Service which runs under:
localhost:8080/delivery/delivery

But before getting to that Service, I want to read the cookie in that Request in my Gateway (For Authentication stuff)

ServerHttpRequest request = exchange.getRequest();

String requestPath = request.getURI().getPath();
String requestMethod = request.getMethod().toString();

When I log the last two lines, I get the right output (Get and /delivery/delivery)

However, If I want to access the cookies of that Request, I get nothing.

I triple checked with Postman, if there are cookies Set.

Does anyone has a clue?

Title: ServerHttpRequest.getCookies() is null


问:
Podman: changing mounted volume permissions
I have a folder, which originally has 0740 permissions.

I can not change the permissions of original folder for security reasons, neither can I use
podman unshare chown as I need to keep original ownership for using it outside the container.

What I want is to change the permissions of mounted volume to 0774 recursively (only read access required), keeping the original folder's permission unchanged.

Is it possible, and at which stage it should be done? I've tried to do this in pre_spawn_hook, but at this point there're no mounted volumes yet.


问:
Expo useAuthRequest Alpaca markets OAuth requires response_type. The app opens an allows me to sign into the alpaca account but authentication fails?
I am building an app with react native and expo. I need users to sign into another service called Alpaca Markets. I am using useAuthRequest from expo. I have the client ID set I am using

```<code>extraParams: {
        response_type: client_secret
      },
</code>```

to pass in the response type witch alpaca requires. But authentication is failing. Here is alpacas reference to Oauth https://alpaca.markets/docs/api-references/oauth-api/

here is my current code:

```<code>const discovery = {
    authorizationEndpoint: "https://app.alpaca.markets/oauth/authorize",
    tokenEndpoint: "https://api.alpaca.markets/oauth/token",
  };
  const [request, response, promptAsync] = useAuthRequest(
    {
      clientId: 'client_id',
      extraParams: {
        response_type: client_secret
      },
      // In order to follow the "Authorization Code Flow" to fetch token after authorizationEndpoint
      // this must be set to false
      usePKCE: false,
      redirectUri: makeRedirectUri({
        scheme: 'mycoolredirect'
      }),
    },
    discovery
  );

  React.useEffect(() => {
    if (response?.type === 'success') {
      const { code } = response.params;
    }
  }, [response]);
</code>```

I tried changing extra params to responseType and it still did not work.

Body:
I am building an app with react native and expo. I need users to sign into another service called Alpaca Markets. I am using useAuthRequest from expo. I have the client ID set I am using

extraParams: {
        response_type: client_secret
      },

to pass in the response type witch alpaca requires. But authentication is failing. Here is alpacas reference to Oauth https://alpaca.markets/docs/api-references/oauth-api/

here is my current code:

const discovery = {
    authorizationEndpoint: "https://app.alpaca.markets/oauth/authorize",
    tokenEndpoint: "https://api.alpaca.markets/oauth/token",
  };
  const [request, response, promptAsync] = useAuthRequest(
    {
      clientId: 'client_id',
      extraParams: {
        response_type: client_secret
      },
      // In order to follow the "Authorization Code Flow" to fetch token after authorizationEndpoint
      // this must be set to false
      usePKCE: false,
      redirectUri: makeRedirectUri({
        scheme: 'mycoolredirect'
      }),
    },
    discovery
  );

  React.useEffect(() => {
    if (response?.type === 'success') {
      const { code } = response.params;
    }
  }, [response]);

I tried changing extra params to responseType and it still did not work.


问:
How to bypass Mac permission to run .command or .sh file
I have to make a click to run  .command/ shell script (.sh) for my users on mac.

I did manage to make .sh work=> to do that I have to type these in to terminal at that folder.

```<code>chmod a+x myFile.sh
</code>```

But none of my users are technical. So they cant type on terminal.

I tried creating .command file. But this also needs special permission to execute.
And that permission cant be given via right click- info - permissions.
This permission can only given by terminal code.Thx to stpd mac security policies.

Also  creating .app won't work , because that way also needs a permission code on terminal.

Is there any hero to help me solve this problem

Edit 1: Forgot to mention that app I am trying to distribute is Java app, .jar. I need to run sh to run specific commands to run myapp.jar.

Body:
I have to make a click to run  .command/ shell script (.sh) for my users on mac.

I did manage to make .sh work=> to do that I have to type these in to terminal at that folder.

chmod a+x myFile.sh

But none of my users are technical. So they cant type on terminal.

I tried creating .command file. But this also needs special permission to execute.
And that permission cant be given via right click- info - permissions.
This permission can only given by terminal code.Thx to stpd mac security policies.

Also  creating .app won't work , because that way also needs a permission code on terminal.

Is there any hero to help me solve this problem

Edit 1: Forgot to mention that app I am trying to distribute is Java app, .jar. I need to run sh to run specific commands to run myapp.jar.


问:
Circle label in subplot matplotlib
I am trying to draw subplots. I need to put labels at specific points as given in the code using scatter. The problem is I can see that the circular label is coming in the left most plot but not in middle and right panels. The data file are availbale here

My program
`

```<code>from pylab import *
from matplotlib import *
import matplotlib as mpl
import os

from global_tools import *

path = os.getcwd()+"/"

print("Plotting allowed range...")

fig = plt.figure(figsize=[15,5])
ax = fig.add_subplot(1,3,1)

ax.set_xscale('log')
ax.set_yscale('linear')
pylab.xlim([1e-15, 1e-13])
pylab.ylim([180, 265])

lst_colors = ['#489E00', '#FEE08B', '#D53E4F', '#0066CC', '#489E00', '#FF3333', '#000000']

lst_limits = Read_Data_File(path+"12.txt")
lst_V = [10**lst_limits[0][j] for j in range(len(lst_limits[0]))]
lst_dcp = [lst_limits[1][j] for j in range(len(lst_limits[1]))]

lst_limits2 = Read_Data_File(path+"11.txt")
lst_V2 = [10**lst_limits2[0][j] for j in range(len(lst_limits2[0]))]
lst_dcp2 = [lst_limits2[1][j] for j in range(len(lst_limits2[1]))]

lst_limits3 = Read_Data_File(path+"13.txt")
lst_V3 = [10**lst_limits3[0][j] for j in range(len(lst_limits3[0]))]
lst_dcp3 = [lst_limits3[1][j] for j in range(len(lst_limits3[1]))]

#circle = plt.Circle((2.11678e-14,223), radius=0.4)
#ax.set_aspect(1)
#ax.add_artist(circle)

ax.plot([2.11678e-14,223], 'og', fillstyle = 'full', ms=10.0)

ax.fill(lst_V, lst_dcp, edgecolor=None, facecolor=lst_colors[0], zorder=0, alpha=0.7)

ax.fill(lst_V2, lst_dcp2, edgecolor=None, facecolor=lst_colors[1], zorder=0, alpha=0.95)

ax.fill(lst_V3, lst_dcp3, edgecolor=None, facecolor=lst_colors[2], zorder=0, alpha=0.7)

ax.scatter(2.11678e-14,223, s=10, facecolors='white', edgecolors='white')

#####-------------------------2nd subplot----------------------------------#######

ax2 = fig.add_subplot(1,3,2)

ax2.set_xscale('log')
ax2.set_yscale('linear')
pylab.xlim([1e-15, 1e-13])
pylab.ylim([180, 265])

lst_limits4 = Read_Data_File(path+"21.txt")
lst_V4 = [10**lst_limits4[0][j] for j in range(len(lst_limits4[0]))]
lst_dcp4 = [lst_limits4[1][j] for j in range(len(lst_limits4[1]))]

lst_limits5 = Read_Data_File(path+"22.txt")
lst_V5 = [10**lst_limits5[0][j] for j in range(len(lst_limits5[0]))]
lst_dcp5 = [lst_limits5[1][j] for j in range(len(lst_limits5[1]))]

lst_limits6 = Read_Data_File(path+"23.txt")
lst_V6 = [10**lst_limits6[0][j] for j in range(len(lst_limits6[0]))]
lst_dcp6 = [lst_limits6[1][j] for j in range(len(lst_limits6[1]))]

ax2.fill(lst_V4, lst_dcp4, edgecolor=None, facecolor=lst_colors[1], zorder=20, alpha=0.95)

ax2.fill(lst_V5, lst_dcp5, edgecolor=None, facecolor=lst_colors[0], zorder=0, alpha=0.7)

ax2.fill(lst_V6, lst_dcp6, edgecolor=None, facecolor=lst_colors[2], zorder=20, alpha=0.7)

ax2.scatter(1.4967e-14,223, s=10, facecolors='white', edgecolors='white')

ax2.tick_params(left = True, right = False , labelleft = False ,
                labelbottom = True, bottom = True)

#####-------------------------3rd subplot----------------------------------#######

ax3 = fig.add_subplot(1,3,3)

ax3.set_xscale('log')
ax3.set_yscale('linear')
pylab.xlim([1e-15, 1e-13])
pylab.ylim([180, 265])

lst_limits7 = Read_Data_File(path+"31.txt")
lst_V7 = [10**lst_limits7[0][j] for j in range(len(lst_limits7[0]))]
lst_dcp7 = [lst_limits7[1][j] for j in range(len(lst_limits7[1]))]

lst_limits8 = Read_Data_File(path+"32.txt")
lst_V8 = [10**lst_limits8[0][j] for j in range(len(lst_limits8[0]))]
lst_dcp8 = [lst_limits8[1][j] for j in range(len(lst_limits8[1]))]

lst_limits9 = Read_Data_File(path+"33.txt")
lst_V9 = [10**lst_limits9[0][j] for j in range(len(lst_limits9[0]))]
lst_dcp9 = [lst_limits9[1][j] for j in range(len(lst_limits9[1]))]

ax3.fill(lst_V7, lst_dcp7, edgecolor=None, facecolor=lst_colors[1], zorder=20, alpha=0.95)

ax3.fill(lst_V8, lst_dcp8, edgecolor=None, facecolor=lst_colors[0], zorder=0, alpha=0.7)

ax3.fill(lst_V9, lst_dcp9, edgecolor=None, facecolor=lst_colors[2], zorder=20, alpha=0.7)

ax3.scatter(1.12675e-14,223, s=10, facecolors='white', edgecolors='white')

ax3.tick_params(left = True, right = False, labelleft = False ,labelbottom = True, bottom = True)

pylab.savefig("test.pdf", bbox_inches='tight', dpi=200)
plt.show()
plt.close()

# In[4]:

path = os.getcwd()+"/"

</code>```

`

I do not understand why the other two labels are not coming. Kindly help.

Title: Circle label in subplot matplotlib

Body:
I am trying to draw subplots. I need to put labels at specific points as given in the code using scatter. The problem is I can see that the circular label is coming in the left most plot but not in middle and right panels. The data file are availbale here

My program
`

from pylab import *
from matplotlib import *
import matplotlib as mpl
import os

from global_tools import *

path = os.getcwd()+"/"

print("Plotting allowed range...")

fig = plt.figure(figsize=[15,5])
ax = fig.add_subplot(1,3,1)

ax.set_xscale('log')
ax.set_yscale('linear')
pylab.xlim([1e-15, 1e-13])
pylab.ylim([180, 265])

lst_colors = ['#489E00', '#FEE08B', '#D53E4F', '#0066CC', '#489E00', '#FF3333', '#000000']

lst_limits = Read_Data_File(path+"12.txt")
lst_V = [10**lst_limits[0][j] for j in range(len(lst_limits[0]))]
lst_dcp = [lst_limits[1][j] for j in range(len(lst_limits[1]))]

lst_limits2 = Read_Data_File(path+"11.txt")
lst_V2 = [10**lst_limits2[0][j] for j in range(len(lst_limits2[0]))]
lst_dcp2 = [lst_limits2[1][j] for j in range(len(lst_limits2[1]))]

lst_limits3 = Read_Data_File(path+"13.txt")
lst_V3 = [10**lst_limits3[0][j] for j in range(len(lst_limits3[0]))]
lst_dcp3 = [lst_limits3[1][j] for j in range(len(lst_limits3[1]))]

#circle = plt.Circle((2.11678e-14,223), radius=0.4)
#ax.set_aspect(1)
#ax.add_artist(circle)

ax.plot([2.11678e-14,223], 'og', fillstyle = 'full', ms=10.0)

ax.fill(lst_V, lst_dcp, edgecolor=None, facecolor=lst_colors[0], zorder=0, alpha=0.7)

ax.fill(lst_V2, lst_dcp2, edgecolor=None, facecolor=lst_colors[1], zorder=0, alpha=0.95)

ax.fill(lst_V3, lst_dcp3, edgecolor=None, facecolor=lst_colors[2], zorder=0, alpha=0.7)

ax.scatter(2.11678e-14,223, s=10, facecolors='white', edgecolors='white')

#####-------------------------2nd subplot----------------------------------#######

ax2 = fig.add_subplot(1,3,2)

ax2.set_xscale('log')
ax2.set_yscale('linear')
pylab.xlim([1e-15, 1e-13])
pylab.ylim([180, 265])

lst_limits4 = Read_Data_File(path+"21.txt")
lst_V4 = [10**lst_limits4[0][j] for j in range(len(lst_limits4[0]))]
lst_dcp4 = [lst_limits4[1][j] for j in range(len(lst_limits4[1]))]

lst_limits5 = Read_Data_File(path+"22.txt")
lst_V5 = [10**lst_limits5[0][j] for j in range(len(lst_limits5[0]))]
lst_dcp5 = [lst_limits5[1][j] for j in range(len(lst_limits5[1]))]

lst_limits6 = Read_Data_File(path+"23.txt")
lst_V6 = [10**lst_limits6[0][j] for j in range(len(lst_limits6[0]))]
lst_dcp6 = [lst_limits6[1][j] for j in range(len(lst_limits6[1]))]

ax2.fill(lst_V4, lst_dcp4, edgecolor=None, facecolor=lst_colors[1], zorder=20, alpha=0.95)

ax2.fill(lst_V5, lst_dcp5, edgecolor=None, facecolor=lst_colors[0], zorder=0, alpha=0.7)

ax2.fill(lst_V6, lst_dcp6, edgecolor=None, facecolor=lst_colors[2], zorder=20, alpha=0.7)

ax2.scatter(1.4967e-14,223, s=10, facecolors='white', edgecolors='white')

ax2.tick_params(left = True, right = False , labelleft = False ,
                labelbottom = True, bottom = True)

#####-------------------------3rd subplot----------------------------------#######

ax3 = fig.add_subplot(1,3,3)

ax3.set_xscale('log')
ax3.set_yscale('linear')
pylab.xlim([1e-15, 1e-13])
pylab.ylim([180, 265])

lst_limits7 = Read_Data_File(path+"31.txt")
lst_V7 = [10**lst_limits7[0][j] for j in range(len(lst_limits7[0]))]
lst_dcp7 = [lst_limits7[1][j] for j in range(len(lst_limits7[1]))]

lst_limits8 = Read_Data_File(path+"32.txt")
lst_V8 = [10**lst_limits8[0][j] for j in range(len(lst_limits8[0]))]
lst_dcp8 = [lst_limits8[1][j] for j in range(len(lst_limits8[1]))]

lst_limits9 = Read_Data_File(path+"33.txt")
lst_V9 = [10**lst_limits9[0][j] for j in range(len(lst_limits9[0]))]
lst_dcp9 = [lst_limits9[1][j] for j in range(len(lst_limits9[1]))]

ax3.fill(lst_V7, lst_dcp7, edgecolor=None, facecolor=lst_colors[1], zorder=20, alpha=0.95)

ax3.fill(lst_V8, lst_dcp8, edgecolor=None, facecolor=lst_colors[0], zorder=0, alpha=0.7)

ax3.fill(lst_V9, lst_dcp9, edgecolor=None, facecolor=lst_colors[2], zorder=20, alpha=0.7)

ax3.scatter(1.12675e-14,223, s=10, facecolors='white', edgecolors='white')

ax3.tick_params(left = True, right = False, labelleft = False ,labelbottom = True, bottom = True)

pylab.savefig("test.pdf", bbox_inches='tight', dpi=200)
plt.show()
plt.close()

# In[4]:

path = os.getcwd()+"/"

`

I do not understand why the other two labels are not coming. Kindly help.


问:
Kibana log location change not writing stdout
I am using docker container for my kibana version 7.4.0. When I run application the logs are writing to console ui.

I am changing the lcoation of destination in kibana.yaml

```<code>logging.dest: /my_volume/kibana.log
</code>```

this creates the log file in destination folder. But the logs does not print stdout console.

how can I do this?

Body:
I am using docker container for my kibana version 7.4.0. When I run application the logs are writing to console ui.

I am changing the lcoation of destination in kibana.yaml

logging.dest: /my_volume/kibana.log

this creates the log file in destination folder. But the logs does not print stdout console.

how can I do this?


问:
How get scheduler in quartz.net in order to use DI
I tried a lot of implementations, but without success.
I'm trying to add a scheduler in .net 6 using quartz.net 3.2.2.

I have a CustomJobFactory, and i want to inject a service into new Job. In order to achieve it i have

```<code>class CustomJobFactory : IJobFactory
{
    protected readonly IServiceProvider _serviceProvider;

    protected readonly ConcurrentDictionary<IJob, IServiceScope> _scopes = new ConcurrentDictionary<IJob, IServiceScope>();

    public CustomJobFactory(IServiceProvider serviceProvider)
    {
        _serviceProvider = serviceProvider;
    }

    public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
    {
        var scope = _serviceProvider.CreateScope();
        IJob job;

        try
        {
            job = scope.ServiceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob;
        }
        catch
        {
            // Failed to create the job -> ensure scope gets disposed
            scope.Dispose();
            throw;
        }

        // Add scope to dictionary so we can dispose it once the job finishes
        if (!_scopes.TryAdd(job, scope))
        {
            // Failed to track DI scope -> ensure scope gets disposed
            scope.Dispose();
            throw new Exception("Failed to track DI scope");
        }

        return job;
    }

    public void ReturnJob(IJob job)
    {
        if (_scopes.TryRemove(job, out var scope))
        {
            scope.Dispose();
        }
    }
}
</code>```

And this is my Job

```<code>    public class HelloWorldJob : IJob, IHelloWorldJob
{

    private static ILogger _logger;

    public HelloWorldJob(ILoggerFactory loggerFactory)
    {
        _logger = loggerFactory.CreateLogger<HelloWorldJob>();
    }

    public Task Execute(IJobExecutionContext context)
    {
        _logger.LogInformation("oook letsgo");
        return Task.CompletedTask;
    }
}
</code>```

So i add quartz in this way

```<code>builder.Services.AddTransient<IJob, HelloWorldJob>();

builder.Services.AddQuartz(q => {

var connstr = "...";
q.UsePersistentStore(c =>
{
    c.UseProperties = true;
    c.UseClustering();
    c.PerformSchemaValidation = true;
    c.UseSqlServer(connstr);
    c.UseJsonSerializer();

});

q.MisfireThreshold = TimeSpan.FromSeconds(60);
q.UseDefaultThreadPool(x => x.MaxConcurrency = 10);
q.SchedulerId = Guid.NewGuid().ToString();
q.SchedulerName = "test";

// q.UseJobFactory<CustomJobFactory>(); tried, i got an exception in new job that explain i not add HelloServerJob in serviceProvider

}

builder.Services.AddQuartzHostedService(
q => q.WaitForJobsToComplete = true);

// tried also this, but i got scheduler null
var container = builder.Services.BuildServiceProvider();
var fct = container.GetRequiredService<ISchedulerFactory>();
var scheduler = await fct.GetScheduler("test");
scheduler.JobFactory = new CustomJobFactory(builder.Services.BuildServiceProvider());
</code>```

Someone could give me and advice? Thanks

Body:
I tried a lot of implementations, but without success.
I'm trying to add a scheduler in .net 6 using quartz.net 3.2.2.

I have a CustomJobFactory, and i want to inject a service into new Job. In order to achieve it i have

class CustomJobFactory : IJobFactory
{
    protected readonly IServiceProvider _serviceProvider;

    protected readonly ConcurrentDictionary<IJob, IServiceScope> _scopes = new ConcurrentDictionary<IJob, IServiceScope>();

    public CustomJobFactory(IServiceProvider serviceProvider)
    {
        _serviceProvider = serviceProvider;
    }

    public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
    {
        var scope = _serviceProvider.CreateScope();
        IJob job;

        try
        {
            job = scope.ServiceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob;
        }
        catch
        {
            // Failed to create the job -> ensure scope gets disposed
            scope.Dispose();
            throw;
        }

        // Add scope to dictionary so we can dispose it once the job finishes
        if (!_scopes.TryAdd(job, scope))
        {
            // Failed to track DI scope -> ensure scope gets disposed
            scope.Dispose();
            throw new Exception("Failed to track DI scope");
        }

        return job;
    }

    public void ReturnJob(IJob job)
    {
        if (_scopes.TryRemove(job, out var scope))
        {
            scope.Dispose();
        }
    }
}

And this is my Job

    public class HelloWorldJob : IJob, IHelloWorldJob
{

    private static ILogger _logger;

    public HelloWorldJob(ILoggerFactory loggerFactory)
    {
        _logger = loggerFactory.CreateLogger<HelloWorldJob>();
    }

    public Task Execute(IJobExecutionContext context)
    {
        _logger.LogInformation("oook letsgo");
        return Task.CompletedTask;
    }
}

So i add quartz in this way

builder.Services.AddTransient<IJob, HelloWorldJob>();

builder.Services.AddQuartz(q => {

var connstr = "...";
q.UsePersistentStore(c =>
{
    c.UseProperties = true;
    c.UseClustering();
    c.PerformSchemaValidation = true;
    c.UseSqlServer(connstr);
    c.UseJsonSerializer();

});

q.MisfireThreshold = TimeSpan.FromSeconds(60);
q.UseDefaultThreadPool(x => x.MaxConcurrency = 10);
q.SchedulerId = Guid.NewGuid().ToString();
q.SchedulerName = "test";

// q.UseJobFactory<CustomJobFactory>(); tried, i got an exception in new job that explain i not add HelloServerJob in serviceProvider

}

builder.Services.AddQuartzHostedService(
q => q.WaitForJobsToComplete = true);

// tried also this, but i got scheduler null
var container = builder.Services.BuildServiceProvider();
var fct = container.GetRequiredService<ISchedulerFactory>();
var scheduler = await fct.GetScheduler("test");
scheduler.JobFactory = new CustomJobFactory(builder.Services.BuildServiceProvider());

Someone could give me and advice? Thanks


问:
Openam instance has http connections disabled
I can't connect to OpenAM through HTTP, only through HTTPS. When I run the Opends status file, it says HTTP Port 8080 is disabled.
I'm working with the default configuration and the embedded Opends and Opendj.

Here are the results of running the /config/opends/config/bin/status file.

```<code>root@openam:/usr/openam/config/opends/bin# ./status

>>>> Specify OpenDJ LDAP connection parameters

Administrator user bind DN [cn=Directory Manager]:

Password for user 'cn=Directory Manager':

          --- Server Status ---
Server Run Status:        Started
Open Connections:         17

          --- Server Details ---
Host Name:                openam.example.com
Administrative Users:     cn=Directory Manager
Installation Path:        /usr/openam/config/opends
Version:                  OpenDJ Server 4.5.0
Java Version:             1.8.0_332
Administration Connector: Port 4444 (LDAPS)

          --- Connection Handlers ---
Address:Port  : Protocol : State
--------------:----------:---------
--            : LDIF     : Disabled
0.0.0.0:636   : LDAPS    : Disabled
0.0.0.0:1689  : JMX      : Enabled
0.0.0.0:8080  : HTTP     : Disabled
0.0.0.0:50389 : LDAP     : Enabled

          --- Data Sources ---
Base DN:     dc=openam,dc=openidentityplatform,dc=org
Backend ID:  userRoot
Entries:     604
Replication:

</code>```

How can I enable HTTP?

Body:
I can't connect to OpenAM through HTTP, only through HTTPS. When I run the Opends status file, it says HTTP Port 8080 is disabled.
I'm working with the default configuration and the embedded Opends and Opendj.

Here are the results of running the /config/opends/config/bin/status file.

root@openam:/usr/openam/config/opends/bin# ./status

>>>> Specify OpenDJ LDAP connection parameters

Administrator user bind DN [cn=Directory Manager]:

Password for user 'cn=Directory Manager':

          --- Server Status ---
Server Run Status:        Started
Open Connections:         17

          --- Server Details ---
Host Name:                openam.example.com
Administrative Users:     cn=Directory Manager
Installation Path:        /usr/openam/config/opends
Version:                  OpenDJ Server 4.5.0
Java Version:             1.8.0_332
Administration Connector: Port 4444 (LDAPS)

          --- Connection Handlers ---
Address:Port  : Protocol : State
--------------:----------:---------
--            : LDIF     : Disabled
0.0.0.0:636   : LDAPS    : Disabled
0.0.0.0:1689  : JMX      : Enabled
0.0.0.0:8080  : HTTP     : Disabled
0.0.0.0:50389 : LDAP     : Enabled

          --- Data Sources ---
Base DN:     dc=openam,dc=openidentityplatform,dc=org
Backend ID:  userRoot
Entries:     604
Replication:

How can I enable HTTP?


问:
omnipay/paypal and notifyUrl issue
Dear stackoverflow community,

Recently PayPal contacted me to upgrade my 'old-style' CodeIgniter e-commerce cart (an old standard paypal gateway with a simple form to related paypal endpoint) to a solution with access token and client_id + secret. I used omnipay-paypal, following a guide like this:

https://artisansweb.net/paypal-payment-gateway-integration-in-php-using-paypal-rest-api/

And everything seems working fine, but with old standard cart I used a notifyUrl to send payment post data to a controller that made something like this:

```<code>foreach ($_POST as $key => $value) {
$request .= '&' . $key . '=' . urlencode(html_entity_decode($value, ENT_QUOTES, 'UTF-8'));
}

$curl = curl_init('https://www.paypal.com/cgi-bin/webscr');

curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 120);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$response = curl_exec($curl);
</code>```

If that $response is VERIFIED, I enable related order for delivery (paid).
Issue is that notifyUrl isn't triggered at all with Omnipay and this avoids to fit the shoe.

I tried to setup notifyUrl parameter on purchase, completePurchase method, but nothing to do: no call is sent after payment confirmation and no payment data in the related $_POST object.

Someone could give me some hint or help?

I tried to force the notifyUrl in any possible way, but after transaction is complete and payment confirmed, the notifyUrl is not receiving the expected data with post.

Title: omnipay/paypal and notifyUrl issue

Body:
Dear stackoverflow community,

Recently PayPal contacted me to upgrade my 'old-style' CodeIgniter e-commerce cart (an old standard paypal gateway with a simple form to related paypal endpoint) to a solution with access token and client_id + secret. I used omnipay-paypal, following a guide like this:

https://artisansweb.net/paypal-payment-gateway-integration-in-php-using-paypal-rest-api/

And everything seems working fine, but with old standard cart I used a notifyUrl to send payment post data to a controller that made something like this:

foreach ($_POST as $key => $value) {
$request .= '&' . $key . '=' . urlencode(html_entity_decode($value, ENT_QUOTES, 'UTF-8'));
}

$curl = curl_init('https://www.paypal.com/cgi-bin/webscr');

curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 120);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$response = curl_exec($curl);

If that $response is VERIFIED, I enable related order for delivery (paid).
Issue is that notifyUrl isn't triggered at all with Omnipay and this avoids to fit the shoe.

I tried to setup notifyUrl parameter on purchase, completePurchase method, but nothing to do: no call is sent after payment confirmation and no payment data in the related $_POST object.

Someone could give me some hint or help?

I tried to force the notifyUrl in any possible way, but after transaction is complete and payment confirmed, the notifyUrl is not receiving the expected data with post.


问:
django-ratings problem
I have just installed the django-ratings app and I am having some trouble getting it working.
I have successfully added a rating field to my model, however, in the documentation, it says  you can get a list of records by rating by using the following code:

```<code>    # In this example, ``rating`` is the attribute name for your ``RatingField``
    qs = qs.extra(select={
        'rating': '((100/%s*rating_score/(rating_votes+%s))+100)/2' % (MyModel.rating.range, MyModel.rating.weight)
    })
    qs = qs.order_by('-rating')
</code>```

I have added the following to my class based generic view:

```<code>def get_queryset(self):
        return Resource.objects.filter(user=self.request.user).extra(select={
        'rating': '((100/%s*rating_score/(rating_votes+%s))+100)/2' % (Resource.rating.range, Resource.rating.weight)
    })
</code>```

However, this gives me the following error:

```<code>'RatingField' object has no attribute 'range'
</code>```

Can anyone see what I might have done wrong?

Any advice appreciated.

Thanks.

ContentLicense: CC BY-SA 3.0

Title: django-ratings problem

Body:
I have just installed the django-ratings app and I am having some trouble getting it working.
I have successfully added a rating field to my model, however, in the documentation, it says  you can get a list of records by rating by using the following code:

    # In this example, ``rating`` is the attribute name for your ``RatingField``
    qs = qs.extra(select={
        'rating': '((100/%s*rating_score/(rating_votes+%s))+100)/2' % (MyModel.rating.range, MyModel.rating.weight)
    })
    qs = qs.order_by('-rating')

I have added the following to my class based generic view:

def get_queryset(self):
        return Resource.objects.filter(user=self.request.user).extra(select={
        'rating': '((100/%s*rating_score/(rating_votes+%s))+100)/2' % (Resource.rating.range, Resource.rating.weight)
    })

However, this gives me the following error:

'RatingField' object has no attribute 'range'

Can anyone see what I might have done wrong?

Any advice appreciated.

Thanks.


问:
How do I configure the NewWindowRequested in Webview2 Core using PowerShell
I am creating a PowerShell script which loads Speedtest.net but I do not want users to navigate away or click on links to open new web pages. I have found a way to detect when the source changes in the userform to go back to the desired URL but some links on the page open new windows and I am not able to suppress that. Here is the code I have:

`

```<code>$ScriptPath = [System.AppDomain]::CurrentDomain.BaseDirectory.TrimEnd('\')
[xml]$XAML = @"
<Window x:Class="WPF_Getting_Started.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:WpfTest"
      xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
      mc:Ignorable="d"
      Title="Internet Speed Test $ScriptVersion"
      Height="450"
      Width="800"
>
    <DockPanel>
        <wv2:WebView2 Name="webView"
                  Source="http://www.speedtest.net"
   >
            <wv2:WebView2.CreationProperties>
                <wv2:CoreWebView2CreationProperties BrowserExecutableFolder="" UserDataFolder="$ENV:TEMP"/>
            </wv2:WebView2.CreationProperties>
        </wv2:WebView2>
    </DockPanel>
</Window>
"@
#
# Assembly
#
    [void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
    [void][reflection.assembly]::LoadFile("$ScriptPath\Microsoft.Web.WebView2.Core.dll")
    [void][reflection.assembly]::LoadFile("$ScriptPath\Microsoft.Web.WebView2.WinForms.dll")
    [void][reflection.assembly]::LoadFile("$ScriptPath\Microsoft.Web.WebView2.Wpf.dll")
#
# Execution
#
    $XAML.Window.RemoveAttribute("x:Class")
    $XAML.Window.RemoveAttribute("mc:Ignorable")
    $Reader=(New-Object System.Xml.XmlNodeReader $XAML)
    $Form=[Windows.Markup.XamlReader]::Load($Reader)
    $XAML.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]")  | ForEach-Object {
        New-Variable  -Name $_.Name -Value $Form.FindName($_.Name) -Force
    }
    # Webview
    $webview_SourceChanged={
        $webView.Source = "http://www.speedtest.net"
    }
    $webView.add_SourceChanged($webview_SourceChanged)
    # Other form properties
    $Screens = [System.Windows.Forms.Screen]::AllScreens
    $Screen = $Screens | Where {$_.Primary -eq "True"}
    $script:Bounds = $Screen.Bounds
    $Form.Left = $Bounds.Left
    $Form.Top = $Bounds.Top
    $Form.Height = $Bounds.Height
    $Form.Width = $Bounds.Width
    [void]$Form.ShowDialog()
</code>```

`

I thought maybe I could use Event detection:

add_NewWindowRequested

I tried to create an object:

[Microsoft.Web.Webview2.Core.CoreWebView2] $webviewcore = New-Object 'Microsoft.Web.Webview2.Core.CoreWebView2'

But I get an error " A constructor was not found. Cannot find an appropriate constructor for type Microsoft.Web.Webview2.Core.CoreWebView2."

Can any please help me understand how I could stop the Webview2 control from opening a new window?

Body:
I am creating a PowerShell script which loads Speedtest.net but I do not want users to navigate away or click on links to open new web pages. I have found a way to detect when the source changes in the userform to go back to the desired URL but some links on the page open new windows and I am not able to suppress that. Here is the code I have:

`

$ScriptPath = [System.AppDomain]::CurrentDomain.BaseDirectory.TrimEnd('\')
[xml]$XAML = @"
<Window x:Class="WPF_Getting_Started.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:WpfTest"
      xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
      mc:Ignorable="d"
      Title="Internet Speed Test $ScriptVersion"
      Height="450"
      Width="800"
>
    <DockPanel>
        <wv2:WebView2 Name="webView"
                  Source="http://www.speedtest.net"
   >
            <wv2:WebView2.CreationProperties>
                <wv2:CoreWebView2CreationProperties BrowserExecutableFolder="" UserDataFolder="$ENV:TEMP"/>
            </wv2:WebView2.CreationProperties>
        </wv2:WebView2>
    </DockPanel>
</Window>
"@
#
# Assembly
#
    [void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
    [void][reflection.assembly]::LoadFile("$ScriptPath\Microsoft.Web.WebView2.Core.dll")
    [void][reflection.assembly]::LoadFile("$ScriptPath\Microsoft.Web.WebView2.WinForms.dll")
    [void][reflection.assembly]::LoadFile("$ScriptPath\Microsoft.Web.WebView2.Wpf.dll")
#
# Execution
#
    $XAML.Window.RemoveAttribute("x:Class")
    $XAML.Window.RemoveAttribute("mc:Ignorable")
    $Reader=(New-Object System.Xml.XmlNodeReader $XAML)
    $Form=[Windows.Markup.XamlReader]::Load($Reader)
    $XAML.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]")  | ForEach-Object {
        New-Variable  -Name $_.Name -Value $Form.FindName($_.Name) -Force
    }
    # Webview
    $webview_SourceChanged={
        $webView.Source = "http://www.speedtest.net"
    }
    $webView.add_SourceChanged($webview_SourceChanged)
    # Other form properties
    $Screens = [System.Windows.Forms.Screen]::AllScreens
    $Screen = $Screens | Where {$_.Primary -eq "True"}
    $script:Bounds = $Screen.Bounds
    $Form.Left = $Bounds.Left
    $Form.Top = $Bounds.Top
    $Form.Height = $Bounds.Height
    $Form.Width = $Bounds.Width
    [void]$Form.ShowDialog()

`

I thought maybe I could use Event detection:

add_NewWindowRequested

I tried to create an object:

[Microsoft.Web.Webview2.Core.CoreWebView2] $webviewcore = New-Object 'Microsoft.Web.Webview2.Core.CoreWebView2'

But I get an error " A constructor was not found. Cannot find an appropriate constructor for type Microsoft.Web.Webview2.Core.CoreWebView2."

Can any please help me understand how I could stop the Webview2 control from opening a new window?


问:
Different Case's Created Date fieldApiName for Case's list view
I have custom logic to create lisview with filters for any object in SF using metadata api. I noticed when I try to upadate All Opened Cases listview and add filter logic "CreatedDate equals TODAY" (put CASES.CREATED_DATE_DATE_ONLY api name for metadataapi) it's saved. But after refreshing listview getListInfoByName wire returned label = null and fieldApiName = null in filter object(listview is crushed). If I create the same filter and update listview (put CASES.CREATED_DATE api name for metadataapi) it works fine and getListInfoByName wire is not crushed. In another sanboxes it works fine with CASES.CREATED_DATE_DATE_ONLY instead of CASES.CREATED_DATE. So my question is what is the diffrence between sandboxes (some enabled features and etc.)? All sanboxes works fine with CASES.CREATED_DATE_DATE_ONLY and one only needs CASES.CREATED_DATE. Thanks.

I need understand the difference between my sanboxes or smth like that


问:
Active/selected row in grid.js?
We need a grid control in our web application, and we are looking into grid.js. (I’m new to grid.js, so sorry if this is a dumb question. )

Grid.js handle most of our needs – and an MIT license is great! But I’m missing one feature.

We need to handle the concept of an “active row” in the grid. I don’t mean selecting rows with checkboxes – that is supported by grid.js. But that we can set one row as active/selected, rendered in a special color. The user should be able to click on a row to select it – and move the selection with the arrow keys. When the user selects a different row, an event should be fired that we could catch.

Many grid components support this, but I haven’t found anything about it in the grid.js documentation. Am I just missing something? Or do we need to add some plugin? Or do you have any other smart solution?

/Anders from Sweden

Title: Active/selected row in grid.js?


问:
Making a vue single spa application where I get the error "webpack compiled error" when I try to execute the project
ERROR in ./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=css (./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=css)
Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
TypeError: Cannot read properties of undefined (reading 'config')

ERROR in ./src/components/HelloWorld.vue?vue&type=style&index=0&id=469af010&scoped=true&lang=css (./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/HelloWorld.vue?vue&type=style&index=0&id=469af010&scoped=true&lang=css)
Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
TypeError: Cannot read properties of undefined (reading 'config')

I removed the node modules folder and attempted to re-create the project folder, but I received the same error.


问:
Is PowerShell Push-Location Thead-Safe
Is it safe to use Push-Location/Pop-Location inside a ForEach-Object -Parallel block?

I have an existing script in which I am pushing to, and popping from, the location stack. I now want to invoke this script with different arguments inside a parallel ForEach-Object, but am not sure if this is thread-safe. Is there a separate location stack for each runspace, or will each parallel thread be trying to push/pop the same stack?

Title: Is PowerShell Push-Location Thead-Safe


问:
wall instance segmentation with cv2.Sobel
I am new with python

I want to do instance segmentation with Sobel edge detection
the input images are original image and mask image that segmented by Unet(this network only detect wall not instance segment)
the output image is instance segmented
like this
give input image like this:
Input original Image
and here is mask
mask image
and the output should be this:
output image

I wrote some code but it fail at edge detection
here is the code:

```<code>#original image
    original_img = io.imread('1.1.png')
    #mask
    seg_img = io.imread('1.2.png')
    #convert to gray
    seg_hsv = cv2.cvtColor(seg_img, cv2.COLOR_RGB2HSV)
    #create mask
    mask = cv2.inRange(seg_hsv, (0, 50, 50), (10, 255, 255))
    #extract wall from original image
    selected_img = cv2.bitwise_and(original_img, original_img, mask=mask)
    grey = cv2.cvtColor(selected_img, cv2.COLOR_RGB2GRAY)
    #blur
    median_blur = cv2.medianBlur(grey, 9)
    #sobel
    sobel_x = cv2.Sobel(median_blur, cv2.CV_16S, 1, 0, ksize=-1)
    sobel_x_16S = np.absolute(sobel_x)
    sobel_x_8U = np.uint8(sobel_x_16S)
    sobel_y = cv2.Sobel(median_blur, cv2.CV_16S, 0, 1, ksize=-1)
    sobel_y_16S = np.absolute(sobel_y)
    sobel_y_8U = np.uint8(sobel_y_16S)
    edgexy = np.sqrt(sobel_y ** 2 + sobel_x ** 2)
    #find contour
    converted = cv2.convertScaleAbs(edgexy)
    ret, thresh = cv2.threshold(converted, 10, 20, cv2.THRESH_BINARY_INV)
    c, h = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
    for contour in c:
       cv2.drawContours(selected_img, [contour], -1, (0, 255, 0))
    plt.imshow(selected_img, cmap="gray")
    plt.show()
</code>```

i tried the sobel but failed at edge detection and finding contours
also i want to not detect black boxes and person as contour

Body:
I am new with python

I want to do instance segmentation with Sobel edge detection
the input images are original image and mask image that segmented by Unet(this network only detect wall not instance segment)
the output image is instance segmented
like this
give input image like this:
Input original Image
and here is mask
mask image
and the output should be this:
output image

I wrote some code but it fail at edge detection
here is the code:

#original image
    original_img = io.imread('1.1.png')
    #mask
    seg_img = io.imread('1.2.png')
    #convert to gray
    seg_hsv = cv2.cvtColor(seg_img, cv2.COLOR_RGB2HSV)
    #create mask
    mask = cv2.inRange(seg_hsv, (0, 50, 50), (10, 255, 255))
    #extract wall from original image
    selected_img = cv2.bitwise_and(original_img, original_img, mask=mask)
    grey = cv2.cvtColor(selected_img, cv2.COLOR_RGB2GRAY)
    #blur
    median_blur = cv2.medianBlur(grey, 9)
    #sobel
    sobel_x = cv2.Sobel(median_blur, cv2.CV_16S, 1, 0, ksize=-1)
    sobel_x_16S = np.absolute(sobel_x)
    sobel_x_8U = np.uint8(sobel_x_16S)
    sobel_y = cv2.Sobel(median_blur, cv2.CV_16S, 0, 1, ksize=-1)
    sobel_y_16S = np.absolute(sobel_y)
    sobel_y_8U = np.uint8(sobel_y_16S)
    edgexy = np.sqrt(sobel_y ** 2 + sobel_x ** 2)
    #find contour
    converted = cv2.convertScaleAbs(edgexy)
    ret, thresh = cv2.threshold(converted, 10, 20, cv2.THRESH_BINARY_INV)
    c, h = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
    for contour in c:
       cv2.drawContours(selected_img, [contour], -1, (0, 255, 0))
    plt.imshow(selected_img, cmap="gray")
    plt.show()

i tried the sobel but failed at edge detection and finding contours
also i want to not detect black boxes and person as contour


问:
Organizing extensions for Visual Studio
You can use Visual Studio (MSVS) for Python, C++, Qt, C#, Fortran, etc. projects. Each of them requires just right set of enabled extensions and all others preferably disabled and hidden.

Is there a tool to simplify extensions switch in "Manage Extensions" window? For example, pack them in folders, workspaces/presets. Cloning VM's is a bit too heavy and slow solution.
Hiding all unused is especially desirable when you try to experiment with a new tool.

Current alternative is disabling/enabling them manually every major project switch.

To specify which window is supposed to be improved:

Title: Organizing extensions for Visual Studio


问:
Call forwarding
Okay so the problem here is I've been trying to find a dialplan for call forwarding but so far I've found only one on the official site, I configured it according to my requirement but it doesn't work, the call forward number is set but, the call doesn't get forwarded. Could you take a look at the code and tell me what's wrong?

Made some addition in default.xml in the dialplan folder as follows:

<extension name="call_forwarding_activativation">

 <condition field="destination_number" expression="^\*72$">

    <action application="play_and_get_digits" data="3 12 1 14000 # tone_stream://%(10000,0,350,440) silence_stream://250 cfwd_num \d+"/>

    <action application="hash" data="insert/${domain_name}-call_forward/${caller_id_number}/${cfwd_num}"/>

    <action application="playback" data="tone_stream://${bong-ring}"/>

    <action application="hangup"/>

 </condition>

</extension>

<extension name="call_forwarding_deactivation">

 <condition field="destination_number" expression="^\*73$">

    <action application="hash" data="delete/${domain_name}-call_forward/${caller_id_number}/${destination_number}"/>

    <action application="playback" data="tone_stream://${bong-ring}"/>

    <action application="hangup"/>

 </condition>

</extension>

<extension name="call_forwarding_number" continue="true">

 <condition>

    <action application="set" data="call_forwarding_number=${hash(select/${domain_name}-call_forward/${destination_number})}"/>

 </condition>

</extension>

And then added this part of the code to features.xml

<extension name="call_forwarding_activativation">

 <condition field="destination_number" expression="^\*72$">

    <action application="play_and_get_digits" data="3 12 1 14000 # tone_stream://%(10000,0,350,440) silence_stream://250 cfwd_num \d+"/>

    <action application="hash" data="insert/${domain_name}-call_forward/${caller_id_number}/${cfwd_num}"/>

    <action application="playback" data="tone_stream://${bong-ring}"/>

    <action application="hangup"/>

 </condition>

</extension>

<extension name="call_forwarding_deactivation">

 <condition field="destination_number" expression="^\*73$">

    <action application="hash" data="delete/${domain_name}-call_forward/${caller_id_number}/${destination_number}"/>

    <action application="playback" data="tone_stream://${bong-ring}"/>

    <action application="hangup"/>

 </condition>

</extension>

<extension name="call_forwarding_number" continue="true">

 <condition>

    <action application="set" data="call_forwarding_number=${hash(select/${domain_name}-call_forward/${destination_number})}"/>

 </condition>

</extension>

<extension name="check_call_forwarding" condition="true">

 <condition field="destination_number" expression="^(\d+)$">

  <action application="execute_extension" data="is_forward XML features"/>

  <action application="bridge" data="sofia/internal/$1@{domain_name}"/>

 </condition>

</extension>

I tried the code above to implement call forwarding, the forwarding number gets assigned but the call doesn't forward

Title: Call forwarding


问:
Read data from GCS in azure databricks with account impersonation
I am trying to read the data from a gcs bucket to Azure databricks spark/pyspark using service account impersonation. I tried giving

```<code>"google.cloud.auth.service.account.enable", "false"
"fs.gs.auth.impersonation.service.account.for.user.<USER_NAME>"
"fs.gs.auth.impersonation.service.account.for.group.<GROUP_NAME>"
"fs.gs.auth.impersonation.service.account"
</code>```

But authentication is failing with below error

```<code>IllegalArgumentException: No valid credential configuration discovered:
</code>```

Any idea or suggestion?

Body:
I am trying to read the data from a gcs bucket to Azure databricks spark/pyspark using service account impersonation. I tried giving

"google.cloud.auth.service.account.enable", "false"
"fs.gs.auth.impersonation.service.account.for.user.<USER_NAME>"
"fs.gs.auth.impersonation.service.account.for.group.<GROUP_NAME>"
"fs.gs.auth.impersonation.service.account"

But authentication is failing with below error

IllegalArgumentException: No valid credential configuration discovered:

Any idea or suggestion?