问:
pod lib lint failed to validate a Kotlin multiplatform library
we are following the KMM documentation to build a very simple library available for our IOS and Android apps.

Following the sample project generated by android studio for a KMM library, we were able to  install and intergrate manually the library built, in a IOS project.

Now we are trying to publish this library on cocoapod and make it available for installation.

The lib is called shared.. a shared.podspec is generated..
if we run

pod lib lint shared/shared.podspec  --verbose

we have an error

`Testing with xcodebuild.
-> shared (0.3)

```<code>- WARN  | url: The URL (https://github.com/OUR_REPO_URL) is not reachable.
- WARN  | http: The URL (``) doesn't use the encrypted HTTPS protocol. It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. This will be an error in future releases. Please update the URL to use https.
- WARN  | [iOS] license: Unable to find a license file
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- NOTE  | xcodebuild:  note: Using new build system
- NOTE  | xcodebuild:  note: Using codesigning identity override: -
- NOTE  | xcodebuild:  note: Build preparation complete
- NOTE  | [iOS] xcodebuild:  note: Planning
- NOTE  | [iOS] xcodebuild:  note: Building targets in dependency order
- NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')`
</code>```

Scrolling up to the error I got:

`
/bin/sh -c /Users/andreadg/Library/Developer/Xcode/DerivedData/App-aamafucqqbvtfsfaselpdjormnrg/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/shared.build/Script-46EB2E000002E0.sh
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework                     -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME                     -Pkotlin.native.cocoapods.archs="$ARCHS"                     -Pkotlin.native.cocoapods.configuration="$CONFIGURATION"

```<code>FAILURE: Build failed with an exception.

* What went wrong:
Directory '/' does not contain a Gradle build.

A Gradle build should contain a 'settings.gradle' or 'settings.gradle.kts' file in its root directory. It may also contain a 'build.gradle' or 'build.gradle.kts' file.

To create a new Gradle build in this directory run 'gradlew init'
</code>```

`

Project structure below
enter image description here

Any idea?

also
pod repo push fails
we tried to publish the library manually ignoring the lint , and it installed with no errors but it fails later during the build of the ios project.

kdoctor doesn't give any error. All good.

Body:
we are following the KMM documentation to build a very simple library available for our IOS and Android apps.

Following the sample project generated by android studio for a KMM library, we were able to  install and intergrate manually the library built, in a IOS project.

Now we are trying to publish this library on cocoapod and make it available for installation.

The lib is called shared.. a shared.podspec is generated..
if we run

pod lib lint shared/shared.podspec  --verbose

we have an error

`Testing with xcodebuild.
-> shared (0.3)

- WARN  | url: The URL (https://github.com/OUR_REPO_URL) is not reachable.
- WARN  | http: The URL (``) doesn't use the encrypted HTTPS protocol. It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. This will be an error in future releases. Please update the URL to use https.
- WARN  | [iOS] license: Unable to find a license file
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- NOTE  | xcodebuild:  note: Using new build system
- NOTE  | xcodebuild:  note: Using codesigning identity override: -
- NOTE  | xcodebuild:  note: Build preparation complete
- NOTE  | [iOS] xcodebuild:  note: Planning
- NOTE  | [iOS] xcodebuild:  note: Building targets in dependency order
- NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')`

Scrolling up to the error I got:

`
/bin/sh -c /Users/andreadg/Library/Developer/Xcode/DerivedData/App-aamafucqqbvtfsfaselpdjormnrg/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/shared.build/Script-46EB2E000002E0.sh
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework                     -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME                     -Pkotlin.native.cocoapods.archs="$ARCHS"                     -Pkotlin.native.cocoapods.configuration="$CONFIGURATION"

FAILURE: Build failed with an exception.

* What went wrong:
Directory '/' does not contain a Gradle build.

A Gradle build should contain a 'settings.gradle' or 'settings.gradle.kts' file in its root directory. It may also contain a 'build.gradle' or 'build.gradle.kts' file.

To create a new Gradle build in this directory run 'gradlew init'

`

Project structure below
enter image description here

Any idea?

also
pod repo push fails
we tried to publish the library manually ignoring the lint , and it installed with no errors but it fails later during the build of the ios project.

kdoctor doesn't give any error. All good.


来源: stackexchange

问:
keycloak custom identity provider giving build error .I have implemented a custom AbstractIdentityProvider but getting build error
I have implemented a custom idp class extending AbstractIdentityProviderMapper .
and i am getting below error while building and i am using keycloak 17 :

ERROR: Failed to run 'build' command.
ERROR: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.deployment.steps.MainClassBuildStep#build threw an exception: java.lang.RuntimeException: Failed to record call to method public void org.keycloak.quarkus.runtime.KeycloakRecorder.configSessionFactory(java.util.Map,java.util.Map,java.util.Map,java.lang.Boolean)
at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:509)
at io.quarkus.deployment.steps.MainClassBuildStep.writeRecordedBytecode(MainClassBuildStep.java:444)

Entire Problem statement is well mentioned here

I have implemented a abstractIdentityProvider mapper to call logic execution upon authentication from external idp .

ContentLicense: CC BY-SA 4.0


问:
Type annotation for non iterables
I want to write an annotation for variables that are not iterables.

```<code>def f(x: NonIterable):
    if not isinstance(x, Iterable):
        pass
    else:
        raise TypeError
</code>```

As you can see in the function the definition of a NonIterable is clear, but I am struggling to turn that into a type annotation.

Title: Type annotation for non iterables

Body:
I want to write an annotation for variables that are not iterables.

def f(x: NonIterable):
    if not isinstance(x, Iterable):
        pass
    else:
        raise TypeError

As you can see in the function the definition of a NonIterable is clear, but I am struggling to turn that into a type annotation.


问:
Data is being displayed in the console, but doesn't in the UI Page
I've created a React table, and I have a data in Elasticsearch. I have successfully fetched data from Elasticsearch using API(fetch) call; this data is being displayed in the console but not in screen. How to solve this problem?

this code will fetch data from Elasticsearch, then display it on React Table.

import './App.css';
import Table from './pages/Table';
import { useEffect, useState } from 'react';

function App() {

  const [dataTable, setDataTable] = useState([]);

    // this is our JOSN data to be displayed in the console
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic xxcxxxxxxxxx==");
myHeaders.append("Content-Type", "application/json");

var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};

 // this is fetching data from Elastic and working successfully

useEffect(() => {
  fetch("https://192.168.1.3:9200/myapp/_doc/1", requestOptions)
.then(response => response.json())
 .then(result => setDataTable(result.data))   // the error comes here
.catch(error => console.log('error', error));
}, []);
console.log(dataTable);

  const column = [
    { heading: 'Id', value: '_index' },
      { heading: 'Index', value: '_index' },
    { heading: 'Score', value: '_score' },
    { heading: 'Timestamp', value: '@timestamp' },
    { heading: 'Version', value: '@version' },

    { heading: 'Ephemeral Id', value: 'agent.ephemeral_id' },
    { heading: 'Agent Id', value: 'agent.id' },
    { heading: 'Agent name', value: 'agent.name' },
    { heading: 'Agent type', value: 'agent.type' },
    { heading: 'Agent Version', value: 'agent.version' },

    { heading: 'esc version', value: 'esc.version' },
    { heading: 'event original', value: 'event.original' },

    { heading: 'host architecture', value: 'host.architecture' },
    { heading: 'host hostname', value: 'host.hostname' },
    { heading: 'host id', value: 'host.id' },
    { heading: 'host ip', value: 'host.ip' },
    { heading: 'host mac', value: 'host.mac' },
    { heading: 'host name', value: 'host.name' },

    { heading: 'host os build', value: 'host.os.build' },
    { heading: 'host os family', value: 'host.os.family' },
    { heading: 'host os kernel', value: 'host.os.kernel' },
    { heading: 'host os name', value: 'host.os.name' },
    { heading: 'host os platform', value: 'host.os.platform' },
    { heading: 'host os type', value: 'host.os.type' },
    { heading: 'host os version', value: 'host.os.version' },

    { heading: 'input type', value: 'input.type' },
    { heading: 'log file path', value: 'log.file.path' },
    { heading: 'log offset', value: 'log.offset' },
    { heading: 'message', value: 'message' },
    { heading: 'tags', value: 'tags' },

  ]

//   console.log(column)
  return (

eSafe Table

  );
    }
export default App;```


问:
React-hydration-error every time when I put motion from framer-motion
I am facing a hydration error when trying to add motion from framer-motion in any element from the file.

Without motion, everything works fine:

```<code>import { useRef, useState, useEffect } from 'react';
import { usePathname, useRouter } from 'next/navigation';
import Image from 'next/image';
import Link from 'next/link';
import { Icon, Dropdown, UserIcon } from '@ui';
import { menuItems } from '@utils/menu';
import useOutsideClick from '@hooks/useOutsideClick';
import { useAppDispatch, useAppSelector } from '@hooks/reduxHooks';
import { triggerCloseMenu } from 'redux/Slices/menuSlice';
import { motion } from 'framer-motion';

const Header = () => {
  const [url, setUrl] = useState<string>('/images/logoLight.png');
  const dispatch = useAppDispatch();
  const close = () => {
    dispatch(triggerCloseMenu());
  };
  const menuOpen = useAppSelector((state) => state.menu.menuOpen);
  const wrapperRef = useRef(null);
  const pathname = usePathname();
  const router = useRouter();
  useOutsideClick(wrapperRef, close);

  useEffect(() => {
    setUrl(
      pathname === '/'
        ? !menuOpen
          ? '/images/logoLight.png'
          : '/images/logoDark.png'
        : '/images/logoDark.png',
    );
  }, [menuOpen, pathname]);

  return (
    <header
      className="fixed top-0 z-50 w-screen  bg-transparent "
      ref={wrapperRef}
    >
      <nav className="  mx-auto flex w-full max-w-[2000px] items-center justify-between py-9 px-7 ">
        <div className="flex items-center justify-center space-x-6">
          <Icon />
          <Image
            src={url}
            alt="logo_image"
            width={120}
            height={0}
            className="mb-1"
            onClick={() => {
              router.push('/');
              close();
            }}
          />
        </div>
        <div className="relative flex items-center space-x-10">
          <div className="hidden space-x-14 lg:flex">
            {menuItems.map((i: Menu) => (
              <Link
                href={i.path}
                key={i.id}
                className={`${
                  pathname !== i.path ? 'font-normal' : 'font-extrabold'
                }
            text-lg text-white transition duration-300 ease-linear`}
              >
                {i.label}
              </Link>
            ))}
          </div>
          <UserIcon />
        </div>
      </nav>
      <Dropdown />
    </header>
  );
};

export default Header;
</code>```

But if I replace   with <motion.header> </motion.header> I am getting this error : Error: Hydration failed because the initial UI does not match what was rendered on the server.

I am using latest version of Nextjs (without app directory), and framer-motion v8

Body:
I am facing a hydration error when trying to add motion from framer-motion in any element from the file.

Without motion, everything works fine:

import { useRef, useState, useEffect } from 'react';
import { usePathname, useRouter } from 'next/navigation';
import Image from 'next/image';
import Link from 'next/link';
import { Icon, Dropdown, UserIcon } from '@ui';
import { menuItems } from '@utils/menu';
import useOutsideClick from '@hooks/useOutsideClick';
import { useAppDispatch, useAppSelector } from '@hooks/reduxHooks';
import { triggerCloseMenu } from 'redux/Slices/menuSlice';
import { motion } from 'framer-motion';

const Header = () => {
  const [url, setUrl] = useState<string>('/images/logoLight.png');
  const dispatch = useAppDispatch();
  const close = () => {
    dispatch(triggerCloseMenu());
  };
  const menuOpen = useAppSelector((state) => state.menu.menuOpen);
  const wrapperRef = useRef(null);
  const pathname = usePathname();
  const router = useRouter();
  useOutsideClick(wrapperRef, close);

  useEffect(() => {
    setUrl(
      pathname === '/'
        ? !menuOpen
          ? '/images/logoLight.png'
          : '/images/logoDark.png'
        : '/images/logoDark.png',
    );
  }, [menuOpen, pathname]);

  return (

          <Icon />
          <Image
            src={url}
            alt="logo_image"
            width={120}
            height={0}
            className="mb-1"
            onClick={() => {
              router.push('/');
              close();
            }}
          />

            {menuItems.map((i: Menu) => (
              <Link
                href={i.path}
                key={i.id}
                className={`${
                  pathname !== i.path ? 'font-normal' : 'font-extrabold'
                }
            text-lg text-white transition duration-300 ease-linear`}
              >
                {i.label}
              </Link>
            ))}

          <UserIcon />

      <Dropdown />

  );
};

export default Header;

But if I replace   with <motion.header> </motion.header> I am getting this error : Error: Hydration failed because the initial UI does not match what was rendered on the server.

I am using latest version of Nextjs (without app directory), and framer-motion v8


问:
How can I integrate a decoder to input embeddings from pretrained transformer model?
I'm trying to develop a transformer model to find protein metal binding sites. The data I have has aminoacid sequences and their binding information of each. For instance:

Q G H M T --> 0 Mg 0 0 Na respectively.

I used pretrained t5 model (prot_t5_xl_bfd) to get input embeddings but I can not continue with decoder part. What am I supposed to do at this point? How can I create a decoder layer for my output information properly or should I?

Can someone enlighten me? I just need a path that how I move on.

I review some resources but those contains pretrained models for both encoding and decoding part. I can not fit any pretrained model on my output type.


问:
CSS Left-Positioning of Grid Cells in Viewport
Seeking a CSS-only method. This is something like a lightbox, but with only one copy of the image in html.

On getting focus, i want the contents of any cell in a grid to move to a floating panel at the center of the viewport.

My intention is to animate the movement of the content from the cell to the floating panel.

When the contents move to the panel, an empty cell should be left behind, so that the following cells don't move up to fill the gap.

The grid parent has grid-template-columns: repeat(auto-fill, 200px), to ensure the cells responsively wrap as the window width changes. Assume all cells are identical and square.

I don't care if the panel moves when page is scrolled, so doesn't have to be position: fixed. Since i use :focus on a link-tag to detect mouse clicks, the panel will disappear on page-scroll anyway. So position: relative works fine.

Things tried:

position-relative

I found that if i set all cells to position: relative, then i can move the cell contents out of the cell, and the contents will overlap surrounding cells (as desired).

But that alone doesn't move the contents to the center of the viewport. The vertical and horizontal distance from the center of the viewport must be calculated. I reasoned i might be able to do that with CSS calc() and some combination of vw, vh, grid-gap, and/or grid-template-columns.

Something like:

```<code>left: calc(-1 * current-column * column-width);
top: calc(-1 * current-row * row-height);
</code>```

Haven't solved it yet. It can be done with JS, but seeking CSS-only method.

grid-column & grid-row

I found i could use grid-column & grid-row to position the spotlight content over a particular cell, but that has issues:

Doesn't seem to support animation

A location on the grid isn't guaranteed to be the center of the viewport

I couldn't figure out how to leave an empty cell behind, so all the following cells moved up to fill the gap.

Thoughts

Can we exploit grid support for overlapping cells?

I don't mind using flex instead of grid, but i think flex doesn't allow overlapping cells (if that matters).

Attempts

This opens a panel at the location of the clicked cell. Items close to the far right or bottom overflow the viewport.
https://codepen.io/johnaweiss/full/vYaXmpE

This opens a panel at a desire central location relative to the viewport, but animation isn't possible, because we must switch from position: block to position: fixed
https://codepen.io/johnaweiss/full/YzjWdPv

Body:
Seeking a CSS-only method. This is something like a lightbox, but with only one copy of the image in html.

On getting focus, i want the contents of any cell in a grid to move to a floating panel at the center of the viewport.

My intention is to animate the movement of the content from the cell to the floating panel.

When the contents move to the panel, an empty cell should be left behind, so that the following cells don't move up to fill the gap.

The grid parent has grid-template-columns: repeat(auto-fill, 200px), to ensure the cells responsively wrap as the window width changes. Assume all cells are identical and square.

I don't care if the panel moves when page is scrolled, so doesn't have to be position: fixed. Since i use :focus on a link-tag to detect mouse clicks, the panel will disappear on page-scroll anyway. So position: relative works fine.

Things tried:

position-relative

I found that if i set all cells to position: relative, then i can move the cell contents out of the cell, and the contents will overlap surrounding cells (as desired).

But that alone doesn't move the contents to the center of the viewport. The vertical and horizontal distance from the center of the viewport must be calculated. I reasoned i might be able to do that with CSS calc() and some combination of vw, vh, grid-gap, and/or grid-template-columns.

Something like:

left: calc(-1 * current-column * column-width);
top: calc(-1 * current-row * row-height);

Haven't solved it yet. It can be done with JS, but seeking CSS-only method.

grid-column & grid-row

I found i could use grid-column & grid-row to position the spotlight content over a particular cell, but that has issues:

Doesn't seem to support animation

A location on the grid isn't guaranteed to be the center of the viewport

I couldn't figure out how to leave an empty cell behind, so all the following cells moved up to fill the gap.

Thoughts

Can we exploit grid support for overlapping cells?

I don't mind using flex instead of grid, but i think flex doesn't allow overlapping cells (if that matters).

Attempts

This opens a panel at the location of the clicked cell. Items close to the far right or bottom overflow the viewport.
https://codepen.io/johnaweiss/full/vYaXmpE

This opens a panel at a desire central location relative to the viewport, but animation isn't possible, because we must switch from position: block to position: fixed
https://codepen.io/johnaweiss/full/YzjWdPv


问:
Puppet Foreman Version 1.16.2 migrate all data to Puppet Foreman Version 3.4.1
We want to update Puppet Foreman 1.16.2 , when the update fails we decide to land a brand new VM with newly installed Foreman Puppet Version 3.4.1 .

Now we need to migrate all hosts and all puppet configurations and classes, in other words migrate data.

We want to find a solution how we can migrate all the necessary information from the old system and start using the updated environment.

We tried to restore the old Puppet Foreman PostgreSQL database to the new Foreman Puppet, but after restoring the new Foreman Puppet stops working.


问:
C# Font dialog disable style selection
I need to disable only the "style" selection on the FontDialog window.
font dialog without "style" list box
It's possible?

For the moment when I applied the font, I overrride the style with the "regular" style. But I prefer to not enable the style selection.

User control Constructor

```<code>c#
public ProgramCtrl(){
    //...
    //other code
    //...
    fontDialog1.AllowScriptChange = false;
    fontDialog1.MaxSize = 10;
    fontDialog1.MinSize = 8;
    fontDialog1.AllowVerticalFonts = false;
    fontDialog1.ShowEffects = false;
    //...
    //other code
    //...
}
</code>```

Event to set the Font

```<code>private void pbPrint1HeadFont_Click(object sender, EventArgs e)
    {
        fontDialog1.Font = tbPrint1Head.Font;
        if (fontDialog1.ShowDialog(this) != DialogResult.Cancel)
        {
            editRecipe.RecPrms[183].Value = fontDialog1.Font.Size.ToString();
            editRecipe.RecPrms[179].Value = fontDialog1.Font.FontFamily.ToString();
            RefreshRecipeView();
        }
    }
</code>```

Overrride of FontStyle

```<code>private RefreshRecipeView(){
    fontName = gSettings.GetFontFamily(editRecipe.RecPrms[179].Value);
    if (!float.TryParse(editRecipe.RecPrms[183].Value, out fontSize))
         fontSize = 8;
     tbPrint1Head.Font = new Font(fontName, fontSize, **FontStyle.Regular**);
}
</code>```

Title: C# Font dialog disable style selection

Body:
I need to disable only the "style" selection on the FontDialog window.
font dialog without "style" list box
It's possible?

For the moment when I applied the font, I overrride the style with the "regular" style. But I prefer to not enable the style selection.

User control Constructor

c#
public ProgramCtrl(){
    //...
    //other code
    //...
    fontDialog1.AllowScriptChange = false;
    fontDialog1.MaxSize = 10;
    fontDialog1.MinSize = 8;
    fontDialog1.AllowVerticalFonts = false;
    fontDialog1.ShowEffects = false;
    //...
    //other code
    //...
}

Event to set the Font

private void pbPrint1HeadFont_Click(object sender, EventArgs e)
    {
        fontDialog1.Font = tbPrint1Head.Font;
        if (fontDialog1.ShowDialog(this) != DialogResult.Cancel)
        {
            editRecipe.RecPrms[183].Value = fontDialog1.Font.Size.ToString();
            editRecipe.RecPrms[179].Value = fontDialog1.Font.FontFamily.ToString();
            RefreshRecipeView();
        }
    }

Overrride of FontStyle

private RefreshRecipeView(){
    fontName = gSettings.GetFontFamily(editRecipe.RecPrms[179].Value);
    if (!float.TryParse(editRecipe.RecPrms[183].Value, out fontSize))
         fontSize = 8;
     tbPrint1Head.Font = new Font(fontName, fontSize, **FontStyle.Regular**);
}


问:
Django allauth facebook utf-8
I`m using django allauth for social login and i get this resulst in extra_data

```<code>"first_name": "\u041a\u0438\u0440\u0438\u043b\u043b",
"name": "\u041a\u0438\u0440\u0438\u043b\u043b \u0412\u0438\u043d\u044e\u043a\u043e\u0432",
</code>```

How can i get these field in normal view?

Title: Django allauth facebook utf-8

Body:
I`m using django allauth for social login and i get this resulst in extra_data

"first_name": "\u041a\u0438\u0440\u0438\u043b\u043b",
"name": "\u041a\u0438\u0440\u0438\u043b\u043b \u0412\u0438\u043d\u044e\u043a\u043e\u0432",

How can i get these field in normal view?


问:
Is there a JS library/function for generating a keyframe function?
I'm currently implementing a JS animation that changes an image's width and height according to scroll depth. I have created a linear function that generates the image height from the scroll depth. I want to change it to a non-linear function I can define using keyframes (as I am used to in video editing software).

I imagine a software where I can set keyframes for the animation duration from 0 to 1 like that:

```<code>0: 400px height
0.5: 400px height
0.75: 200px height
0.95 150px height
1: 150px height
</code>```

It would be best if the library would allow for setting the function in between these keyframes – for example, if I would like to have an exponentially decreasing function between .5 and .75.

Is there a simple way to do something like that?

Body:
I'm currently implementing a JS animation that changes an image's width and height according to scroll depth. I have created a linear function that generates the image height from the scroll depth. I want to change it to a non-linear function I can define using keyframes (as I am used to in video editing software).

I imagine a software where I can set keyframes for the animation duration from 0 to 1 like that:

0: 400px height
0.5: 400px height
0.75: 200px height
0.95 150px height
1: 150px height

It would be best if the library would allow for setting the function in between these keyframes – for example, if I would like to have an exponentially decreasing function between .5 and .75.

Is there a simple way to do something like that?


问:
evaluate a string as method in a python for loop
Eventually I will be using python datetime methods such as day, month and year.

I can easily assign them manually:

```<code>import datetime as dt

year = dt.datetime.today().year
month = dt.datetime.today().month
day = dt.datetime.today().day
</code>```

But as I need to further manipulate them (e.g. transform to str, I guess it is better to do variable assignment inside a loop)

What I have tried so far, and the error messages are displayed below (I have tried one x variable assignment at the time i.e. when I tried one variable assignment, the other attempts were commented)

```<code>import datetime as dt

today = dt.datetime.today()
for i in 'year month day'.split():
    x = today.i # AttributeError: 'datetime.datetime' object has no attribute 'i'
    x = f"{today}.{i}" # does not return an error, but returns '2023-01-04 12:06:45.614862.day'
    x = today.eval(i) # AttributeError: 'datetime.datetime' object has no attribute 'eval'
    x = eval(today.i) # AttributeError: 'datetime.datetime' object has no attribute 'i'
</code>```

So in a nutshell, what I want in my loop is that python transforms the i strings (year, month and day) and use that as a method for today()

Body:
Eventually I will be using python datetime methods such as day, month and year.

I can easily assign them manually:

import datetime as dt

year = dt.datetime.today().year
month = dt.datetime.today().month
day = dt.datetime.today().day

But as I need to further manipulate them (e.g. transform to str, I guess it is better to do variable assignment inside a loop)

What I have tried so far, and the error messages are displayed below (I have tried one x variable assignment at the time i.e. when I tried one variable assignment, the other attempts were commented)

import datetime as dt

today = dt.datetime.today()
for i in 'year month day'.split():
    x = today.i # AttributeError: 'datetime.datetime' object has no attribute 'i'
    x = f"{today}.{i}" # does not return an error, but returns '2023-01-04 12:06:45.614862.day'
    x = today.eval(i) # AttributeError: 'datetime.datetime' object has no attribute 'eval'
    x = eval(today.i) # AttributeError: 'datetime.datetime' object has no attribute 'i'

So in a nutshell, what I want in my loop is that python transforms the i strings (year, month and day) and use that as a method for today()


问:
Handling Windows Authentication failure in Blazor Server app (Kestrel)
I am making a Blazor intranet app with Windows Authentication for domain users, using Kestrel, and .NET 6.0.11. Following the instructions in Configure Windows Authentication in ASP.NET Core (31 Aug 2022), i.e. adding to Program.cs:

```<code>builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
   .AddNegotiate();
builder.Services.AddAuthorization(options => { options.FallbackPolicy = options.DefaultPolicy; });
// ...
app.UseAuthentication();
app.UseAuthorization();
</code>```

This does work, but:

Authentication is performed as soon as the user first connects, and

If authentication fails , the user gets a HTTP 401 response.

There does not appear to be any way to allow anonymous access.

I have found that app.UseStatusCodePages(Text.Plain, "Status Code Page: {0}"); works to "improve" the 401 response, however (unsurprisingly) app.UseStatusCodePagesWithReExecute("/SomePage/{0}"); still generates the 401 response, presumably because SomePage has the same issue.

The presence of app.UseAuthorization() in Program.cs seems to force the authentication to happen on user's first connection. I have tried commenting it out, which (surprisingly) causes the app to run successfully with no authentication even attempted; the GetClaimsPrincipal demo reports no user is authenticated.

(Side question - why is this; I would expect it to try authenticating but then report user as authenticated or not; but with no authorization).

My question is: Is it possible at all to do either of the following things:

Not challenge for authentication at first, but do it only when the user navigates to a certain page or presses a button; or

If the startup Windows Authentication failed, allow Blazor page execution to proceed with no authorized user? (I would use the AuthorizedView, and authorization attributes to limit access to what is appropriate for unauthorized users, and advise them to reload the page to try again).

Note: The question How to handle cancel button of windows authentication pop-up in asp.net core mvc deployed on Kestrel? is similar but for an old version of ASP.NET Core 3: it answers my part (2) with the "trick" being to directing the HTTP error handler to a new View() presumably running "outside" of the rest of the project structure and therefore not triggering automatic authentication again.

However the code in that question does not work in Blazor: it uses HttpContext directly (deprecated now); and it has a different project structure so I don't even see where the code would go.

Body:
I am making a Blazor intranet app with Windows Authentication for domain users, using Kestrel, and .NET 6.0.11. Following the instructions in Configure Windows Authentication in ASP.NET Core (31 Aug 2022), i.e. adding to Program.cs:

builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
   .AddNegotiate();
builder.Services.AddAuthorization(options => { options.FallbackPolicy = options.DefaultPolicy; });
// ...
app.UseAuthentication();
app.UseAuthorization();

This does work, but:

Authentication is performed as soon as the user first connects, and

If authentication fails , the user gets a HTTP 401 response.

There does not appear to be any way to allow anonymous access.

I have found that app.UseStatusCodePages(Text.Plain, "Status Code Page: {0}"); works to "improve" the 401 response, however (unsurprisingly) app.UseStatusCodePagesWithReExecute("/SomePage/{0}"); still generates the 401 response, presumably because SomePage has the same issue.

The presence of app.UseAuthorization() in Program.cs seems to force the authentication to happen on user's first connection. I have tried commenting it out, which (surprisingly) causes the app to run successfully with no authentication even attempted; the GetClaimsPrincipal demo reports no user is authenticated.

(Side question - why is this; I would expect it to try authenticating but then report user as authenticated or not; but with no authorization).

My question is: Is it possible at all to do either of the following things:

Not challenge for authentication at first, but do it only when the user navigates to a certain page or presses a button; or

If the startup Windows Authentication failed, allow Blazor page execution to proceed with no authorized user? (I would use the AuthorizedView, and authorization attributes to limit access to what is appropriate for unauthorized users, and advise them to reload the page to try again).

Note: The question How to handle cancel button of windows authentication pop-up in asp.net core mvc deployed on Kestrel? is similar but for an old version of ASP.NET Core 3: it answers my part (2) with the "trick" being to directing the HTTP error handler to a new View() presumably running "outside" of the rest of the project structure and therefore not triggering automatic authentication again.

However the code in that question does not work in Blazor: it uses HttpContext directly (deprecated now); and it has a different project structure so I don't even see where the code would go.


问:
Chrome-extension send webRequest.onCompleted response URL from background.js to contenScript.js
I'm new to this and was looking online for something that helped and could not reach a good response :(
I'm trying to get a specific request url form a website and store it in a variable in my contentScript file.

To clarify, I don't have a specific error message, I simple can't find a way to communicate the webResponse from background.js with the contentScript.js

my code is as follows:

backgorund.js

```<code>chrome.runtime.onMessage.addListener(
  function (request, sender, sendResponse) {
    switch (request.message) {
      case 'GET_REQUEST_URL':
        //Catch request URL
        let requestUrl = '';
        chrome.webRequest.onCompleted.addListener(
          (response) => { sendResponse(response.url); },
          {
            urls: [
              'https://example1*',
              'https://example2*',
              'https://example3*'
            ]
          }
        );
        break;
    }
  }
);
</code>```

contentScript.js

```<code>let requestUrl = '';
chrome.runtime.sendMessage(
  { message: "GET_REQUEST_URL" },
  response => { requestUrl = response; }
);
</code>```

If I run the chrome.webRequest.onCompleted outside the switch case I get the url needed (see code below), I just can't pass it to contentScript :(

```<code>let requestUrl = '';
chrome.webRequest.onCompleted.addListener(
  (response) => { requestUrl = response.url; },
  {
    urls: [
      'https://example1*',
      'https://example2*',
      'https://example3*'
    ]
  }
);
</code>```

Thank you for the help!

UPDATE WORKING CODE:

backgorund.js

```<code>chrome.runtime.onMessage.addListener(
  function (request, sender, sendResponse) {
    switch (request.message) {
      case 'GET_REQUEST_URL':
        //Catch request URL
        let requestUrl = '';
        chrome.webRequest.onCompleted.addListener(
          (response) => { sendResponse(response.url); },
          {
            urls: [
              'https://example1*',
              'https://example2*',
              'https://example3*'
            ]
          }
        );
        return true;
    }
  }
);
</code>```

contentScript.js

```<code>let requestUrl = '';
chrome.runtime.sendMessage(
  {
    message: "GET_REQUEST_URL",
    callback: response => { response }
 },
  response => { requestUrl = response; }
);
</code>```

Body:
I'm new to this and was looking online for something that helped and could not reach a good response :(
I'm trying to get a specific request url form a website and store it in a variable in my contentScript file.

To clarify, I don't have a specific error message, I simple can't find a way to communicate the webResponse from background.js with the contentScript.js

my code is as follows:

backgorund.js

chrome.runtime.onMessage.addListener(
  function (request, sender, sendResponse) {
    switch (request.message) {
      case 'GET_REQUEST_URL':
        //Catch request URL
        let requestUrl = '';
        chrome.webRequest.onCompleted.addListener(
          (response) => { sendResponse(response.url); },
          {
            urls: [
              'https://example1*',
              'https://example2*',
              'https://example3*'
            ]
          }
        );
        break;
    }
  }
);

contentScript.js

let requestUrl = '';
chrome.runtime.sendMessage(
  { message: "GET_REQUEST_URL" },
  response => { requestUrl = response; }
);

If I run the chrome.webRequest.onCompleted outside the switch case I get the url needed (see code below), I just can't pass it to contentScript :(

let requestUrl = '';
chrome.webRequest.onCompleted.addListener(
  (response) => { requestUrl = response.url; },
  {
    urls: [
      'https://example1*',
      'https://example2*',
      'https://example3*'
    ]
  }
);

Thank you for the help!

UPDATE WORKING CODE:

backgorund.js

chrome.runtime.onMessage.addListener(
  function (request, sender, sendResponse) {
    switch (request.message) {
      case 'GET_REQUEST_URL':
        //Catch request URL
        let requestUrl = '';
        chrome.webRequest.onCompleted.addListener(
          (response) => { sendResponse(response.url); },
          {
            urls: [
              'https://example1*',
              'https://example2*',
              'https://example3*'
            ]
          }
        );
        return true;
    }
  }
);

contentScript.js

let requestUrl = '';
chrome.runtime.sendMessage(
  {
    message: "GET_REQUEST_URL",
    callback: response => { response }
 },
  response => { requestUrl = response; }
);


问:
How do I override the precedence of a header file when using pybind11 and cmake?
I have a header file called node.h within my C++ project, where I am now writing python bindings. Within python, there is also a header file called node.h. I am creating my Python bindings with PyBind11 and CMake similar to:

```<code>cmake_minimum_required(VERSION 3.10)
project(WeatherRouting)
message("Configuring WeatherRouting (python package)")

set(PYBIND11_CPP_STANDARD -std=c++17)

find_package(Python COMPONENTS Interpreter Development)
find_package(pybind11 CONFIG)
include_directories(${ROUTINGLIB_INCLUDE_DIRECTORIES})

file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS LIST_DIRECTORIES false ${CMAKE_CURRENT_SOURCE_DIR}/src *.cpp *.cc)

pybind11_add_module(_WeatherRouting SHARED ${SRC_FILES})
target_link_libraries(_WeatherRouting PRIVATE RoutingLib)
set_target_properties(_WeatherRouting PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
</code>```

And this is causing the header file in python being used, over my header file, when I include my header file like:

```<code>#include "node.h"
</code>```

How do I fix this?

Body:
I have a header file called node.h within my C++ project, where I am now writing python bindings. Within python, there is also a header file called node.h. I am creating my Python bindings with PyBind11 and CMake similar to:

cmake_minimum_required(VERSION 3.10)
project(WeatherRouting)
message("Configuring WeatherRouting (python package)")

set(PYBIND11_CPP_STANDARD -std=c++17)

find_package(Python COMPONENTS Interpreter Development)
find_package(pybind11 CONFIG)
include_directories(${ROUTINGLIB_INCLUDE_DIRECTORIES})

file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS LIST_DIRECTORIES false ${CMAKE_CURRENT_SOURCE_DIR}/src *.cpp *.cc)

pybind11_add_module(_WeatherRouting SHARED ${SRC_FILES})
target_link_libraries(_WeatherRouting PRIVATE RoutingLib)
set_target_properties(_WeatherRouting PROPERTIES POSITION_INDEPENDENT_CODE TRUE)

And this is causing the header file in python being used, over my header file, when I include my header file like:

#include "node.h"

How do I fix this?


问:
CSS child element avoid parent overflow: scroll;
I have a parent element that have inside multiple type of inputs and a horizontal scroll if the number of elements is bigger than width of the parent.

The problem is that when I build the multiple select dropdown element, the actual drop down doesn't get out from parent element, because of the overflow. When you click on Make a selection input, to be able to show the actual dropdown and choose options.

How I can solve this problem?

Codepen demo

/* Multi Select Input JS */

//helper functions

function isOutsideNodeAndChildren($node, e) {
  // if the target of the click isn't the container...
  // nor a descendant of the container
  if (!$node.is(e.target) && $node.has(e.target).length === 0) {
    return true;
  } else {
    return false;
  }
}
// constructor definition
function MultiSelect($select) {
  this.$select = $select;
  this.$outer;
  this.$field;
  this.$optionList;
  this.$options;

  this.isActive = false;

  this.createMultiSelectOption = function (optionText, fieldName) {
    var option = document.createElement("div");
    var checkbox = document.createElement("input");
    var label = document.createElement("label");

    option.className = "multi-select_option";
    option.tabIndex = -1;

    checkbox.className = "multi-select_checkbox";
    checkbox.type = "checkbox";
    checkbox.tabIndex = "-1";
    checkbox.name = fieldName;

    label.className = "multi-select_label";
    label.htmlFor = fieldName;
    label.textContent = optionText;
    label.value = optionText;

    option.appendChild(checkbox);

    option.appendChild(label);

    return option;
  };
  this.toggleSelected = function ($option, e) {
    var $allCheckedOptions;
    var numChecked;
    var checkBox = $option.find(".multi-select_checkbox")[0];
    var $field = $option.parents(".multi-select").find(".multi-select_field");

    if (e.target.type !== "checkbox") {
      if (checkBox.checked) checkBox.checked = false;
      else checkBox.checked = true;
    }

    $allCheckedOptions = $option
      .parent()
      .find(".multi-select_option")
      .has(":checked");
    numChecked = $allCheckedOptions.length;

    if (numChecked) {
      $field.removeClass("is-empty");
      if (numChecked < 2) {
        $field.text($allCheckedOptions.find(".multi-select_label").text());
      } else {
        $field.text(numChecked + " selected");
      }
    } else {
      $field.addClass("is-empty");
      $field.text("Make a selection");
    }
  };

  this.activate = function (that) {
    this.$outer.addClass("is-active");
    this.$optionList.addClass("is-open");
    this.isActive = true;

    // make any click outside of the active multiselect close it.
    $(document).on("click.closeMulti", function (e) {
      if (isOutsideNodeAndChildren(that.$outer, e)) {
        that.deactivate();
      }
    });
  };
  this.deactivate = function () {
    // reset scroll position to top when opened again
    this.$optionList.scrollTop(0);

    this.$outer.removeClass("is-active");
    this.$optionList.removeClass("is-open");
    this.isActive = false;

    $(document).off(".closeMulti");
  };

  this.attachClickEvents = function (that) {
    this.$field.on("click", function (e) {
      // open options if not already open
      if (that.isActive) return;
      that.activate(that);
    });

    this.$options.on("click", function (e) {
      that.toggleSelected($(this), e);
    });
  };
  this.attachKeyboardEvents = function (that) {
    // enforce blur on tab when any part of multi is focused.

    this.$field.on("keydown", function (e) {
      if (e.keyCode === 9) {
        that.deactivate();
        return;
      }

      if (e.keyCode === 40) {
        that.activate(that);
        that.$options.first().focus();

        // don't scroll the options list, let the focus handle that.
        e.preventDefault();
        return;
      }
    });

    this.$options.on("keydown", function (e) {
      switch (e.keyCode) {
        case 9:
          that.deactivate();
          break;
        case 13:
          that.toggleSelected($(this), e);
          break;
        case 40:
          $(this).next().focus();

          // don't scroll the options list, let the focus handle that.
          e.preventDefault();
          break;
        case 38:
          $(this).prev().focus();

          // don't scroll the options list, let the focus handle that.
          e.preventDefault();

          break;
        default:
          // do nothing;
          break;
      }
    });
  };

  this.init = function () {
    var that = this;

    var $options = this.$select.find("option");
    var fieldName = this.$select.attr("name");

    var multiSelect = document.createElement("div");
    var field = document.createElement("div");
    var optionsList = document.createElement("div");

    multiSelect.className = "multi-select";
    field.className = "multi-select_field is-empty";
    field.tabIndex = 0;
    field.textContent = "Make a selection";
    optionsList.className = "multi-select_options";

    $options.each(function () {
      // if option is empty don't include it in the multi-select list
      if (!this.textContent) return;

      var o = that.createMultiSelectOption(this.textContent, fieldName);
      optionsList.appendChild(o);
    });

    multiSelect.appendChild(field);
    multiSelect.appendChild(optionsList);

    // replace regular dropdown w/ multi-select dropdown
    $(multiSelect).insertBefore(this.$select);
    this.$select.remove();
    this.$select = null;

    // cache multiSelect selectors
    this.$outer = $(multiSelect);
    this.$field = this.$outer.find(".multi-select_field");
    this.$optionList = this.$outer.find(".multi-select_options");
    this.$options = this.$outer.find(".multi-select_option");

    // attach multiSelect event handlers
    this.attachClickEvents(this);
    this.attachKeyboardEvents(this);
  };
}

// selectToMultiSelect plugin definition
$.fn.selectToMultiSelect = function (settings) {
  var m = new MultiSelect($(this));
  m.init();
};

$(".js-multi-select").selectToMultiSelect();```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.container {
  width: 500px;
  height: 50px;
  background: red;
  overflow-x: scroll;
}
.wrapper {
  display: flex;
  gap: 10px;
}

.multi-select {
  position: relative;
  max-width: 100%;
  min-width: 200px;
}
.multi-select,
.multi-select *,
.multi-select *:before,
.multi-select *:after {
  box-sizing: border-box;
}
.multi-select_field,
.multi-select_option {
  background: #fff;
  padding-left: 2px;
}
.multi-select_field {
  position: relative;
  height: 25px;
  padding-left: 2px;
  border: 1px solid #aaa;
  line-height: 25px;
  cursor: default;
}
.multi-select_field:hover {
  border-color: #888;
}
.multi-select_field:after {
  content: "";
  position: absolute;
  right: 4px;
  width: 0;
  border-top: 4px solid #000;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  top: 50%;
  transform: translateY(-50%);
}
.multi-select_field.is-empty {
  color: #aaa;
}
.multi-select_options {
  display: none;
  position: absolute;
  width: 100%;
  max-height: 170px;
  border-left: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  border-right: 1px solid #ddd;
  background: #fff;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.15);
  overflow-x: hidden;
}
.is-active .multi-select_options {
  display: block;
}
.multi-select_option {
  background: transparent;
  position: relative;
  z-index: 101;
  height: 30px;
  line-height: 30px;
}
.multi-select_option:hover {
  background: #f0f0f0;
}
.multi-select_option:not(:last-child) {
  border-bottom: 1px solid #ddd;
}
.multi-select_label {
  position: relative;
}
.multi-select_checkbox {
  position: relative;
  top: 2px;
  margin-right: 4px;
  z-index: 101;
}</code>```

    <input type="text">
    <select name="foo" id="foo">
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
    </select>
    <select name="foo" id="foo">
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
    </select>
    <select id="dev" name="testField" id="1" class="js-multi-select">
      <option value="a">This is option 1</option>
      <option value="b">This is option 2</option>
      <option value="c">This is option 3</option>
      <option value="d">This is option 4</option>
      <option value="e">This is option 5</option>
      <option value="e">This is option 5</option>
    </select>

```

Body:
I have a parent element that have inside multiple type of inputs and a horizontal scroll if the number of elements is bigger than width of the parent.

The problem is that when I build the multiple select dropdown element, the actual drop down doesn't get out from parent element, because of the overflow. When you click on Make a selection input, to be able to show the actual dropdown and choose options.

How I can solve this problem?

Codepen demo

/* Multi Select Input JS */

//helper functions

function isOutsideNodeAndChildren($node, e) {
  // if the target of the click isn't the container...
  // nor a descendant of the container
  if (!$node.is(e.target) && $node.has(e.target).length === 0) {
    return true;
  } else {
    return false;
  }
}
// constructor definition
function MultiSelect($select) {
  this.$select = $select;
  this.$outer;
  this.$field;
  this.$optionList;
  this.$options;

  this.isActive = false;

  this.createMultiSelectOption = function (optionText, fieldName) {
    var option = document.createElement("div");
    var checkbox = document.createElement("input");
    var label = document.createElement("label");

    option.className = "multi-select_option";
    option.tabIndex = -1;

    checkbox.className = "multi-select_checkbox";
    checkbox.type = "checkbox";
    checkbox.tabIndex = "-1";
    checkbox.name = fieldName;

    label.className = "multi-select_label";
    label.htmlFor = fieldName;
    label.textContent = optionText;
    label.value = optionText;

    option.appendChild(checkbox);

    option.appendChild(label);

    return option;
  };
  this.toggleSelected = function ($option, e) {
    var $allCheckedOptions;
    var numChecked;
    var checkBox = $option.find(".multi-select_checkbox")[0];
    var $field = $option.parents(".multi-select").find(".multi-select_field");

    if (e.target.type !== "checkbox") {
      if (checkBox.checked) checkBox.checked = false;
      else checkBox.checked = true;
    }

    $allCheckedOptions = $option
      .parent()
      .find(".multi-select_option")
      .has(":checked");
    numChecked = $allCheckedOptions.length;

    if (numChecked) {
      $field.removeClass("is-empty");
      if (numChecked < 2) {
        $field.text($allCheckedOptions.find(".multi-select_label").text());
      } else {
        $field.text(numChecked + " selected");
      }
    } else {
      $field.addClass("is-empty");
      $field.text("Make a selection");
    }
  };

  this.activate = function (that) {
    this.$outer.addClass("is-active");
    this.$optionList.addClass("is-open");
    this.isActive = true;

    // make any click outside of the active multiselect close it.
    $(document).on("click.closeMulti", function (e) {
      if (isOutsideNodeAndChildren(that.$outer, e)) {
        that.deactivate();
      }
    });
  };
  this.deactivate = function () {
    // reset scroll position to top when opened again
    this.$optionList.scrollTop(0);

    this.$outer.removeClass("is-active");
    this.$optionList.removeClass("is-open");
    this.isActive = false;

    $(document).off(".closeMulti");
  };

  this.attachClickEvents = function (that) {
    this.$field.on("click", function (e) {
      // open options if not already open
      if (that.isActive) return;
      that.activate(that);
    });

    this.$options.on("click", function (e) {
      that.toggleSelected($(this), e);
    });
  };
  this.attachKeyboardEvents = function (that) {
    // enforce blur on tab when any part of multi is focused.

    this.$field.on("keydown", function (e) {
      if (e.keyCode === 9) {
        that.deactivate();
        return;
      }

      if (e.keyCode === 40) {
        that.activate(that);
        that.$options.first().focus();

        // don't scroll the options list, let the focus handle that.
        e.preventDefault();
        return;
      }
    });

    this.$options.on("keydown", function (e) {
      switch (e.keyCode) {
        case 9:
          that.deactivate();
          break;
        case 13:
          that.toggleSelected($(this), e);
          break;
        case 40:
          $(this).next().focus();

          // don't scroll the options list, let the focus handle that.
          e.preventDefault();
          break;
        case 38:
          $(this).prev().focus();

          // don't scroll the options list, let the focus handle that.
          e.preventDefault();

          break;
        default:
          // do nothing;
          break;
      }
    });
  };

  this.init = function () {
    var that = this;

    var $options = this.$select.find("option");
    var fieldName = this.$select.attr("name");

    var multiSelect = document.createElement("div");
    var field = document.createElement("div");
    var optionsList = document.createElement("div");

    multiSelect.className = "multi-select";
    field.className = "multi-select_field is-empty";
    field.tabIndex = 0;
    field.textContent = "Make a selection";
    optionsList.className = "multi-select_options";

    $options.each(function () {
      // if option is empty don't include it in the multi-select list
      if (!this.textContent) return;

      var o = that.createMultiSelectOption(this.textContent, fieldName);
      optionsList.appendChild(o);
    });

    multiSelect.appendChild(field);
    multiSelect.appendChild(optionsList);

    // replace regular dropdown w/ multi-select dropdown
    $(multiSelect).insertBefore(this.$select);
    this.$select.remove();
    this.$select = null;

    // cache multiSelect selectors
    this.$outer = $(multiSelect);
    this.$field = this.$outer.find(".multi-select_field");
    this.$optionList = this.$outer.find(".multi-select_options");
    this.$options = this.$outer.find(".multi-select_option");

    // attach multiSelect event handlers
    this.attachClickEvents(this);
    this.attachKeyboardEvents(this);
  };
}

// selectToMultiSelect plugin definition
$.fn.selectToMultiSelect = function (settings) {
  var m = new MultiSelect($(this));
  m.init();
};

$(".js-multi-select").selectToMultiSelect();

.container {
  width: 500px;
  height: 50px;
  background: red;
  overflow-x: scroll;
}
.wrapper {
  display: flex;
  gap: 10px;
}

.multi-select {
  position: relative;
  max-width: 100%;
  min-width: 200px;
}
.multi-select,
.multi-select *,
.multi-select *:before,
.multi-select *:after {
  box-sizing: border-box;
}
.multi-select_field,
.multi-select_option {
  background: #fff;
  padding-left: 2px;
}
.multi-select_field {
  position: relative;
  height: 25px;
  padding-left: 2px;
  border: 1px solid #aaa;
  line-height: 25px;
  cursor: default;
}
.multi-select_field:hover {
  border-color: #888;
}
.multi-select_field:after {
  content: "";
  position: absolute;
  right: 4px;
  width: 0;
  border-top: 4px solid #000;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  top: 50%;
  transform: translateY(-50%);
}
.multi-select_field.is-empty {
  color: #aaa;
}
.multi-select_options {
  display: none;
  position: absolute;
  width: 100%;
  max-height: 170px;
  border-left: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  border-right: 1px solid #ddd;
  background: #fff;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.15);
  overflow-x: hidden;
}
.is-active .multi-select_options {
  display: block;
}
.multi-select_option {
  background: transparent;
  position: relative;
  z-index: 101;
  height: 30px;
  line-height: 30px;
}
.multi-select_option:hover {
  background: #f0f0f0;
}
.multi-select_option:not(:last-child) {
  border-bottom: 1px solid #ddd;
}
.multi-select_label {
  position: relative;
}
.multi-select_checkbox {
  position: relative;
  top: 2px;
  margin-right: 4px;
  z-index: 101;
}

    <input type="text">
    <select name="foo" id="foo">
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
    </select>
    <select name="foo" id="foo">
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
      <option value="a">Select input</option>
    </select>
    <select id="dev" name="testField" id="1" class="js-multi-select">
      <option value="a">This is option 1</option>
      <option value="b">This is option 2</option>
      <option value="c">This is option 3</option>
      <option value="d">This is option 4</option>
      <option value="e">This is option 5</option>
      <option value="e">This is option 5</option>
    </select>


问:
Sort largest 3 out of Top 3 Python
I am new to Python. I am aiming to create an output to find the TOP 3 out of the TOP 3 sorted by the largest for each row. For each row I want to see a percentage distribution.

I looked through the MultiIndex  part. I am able to get some part of it, but would miss Index Number 0,5,10,15. Please see output.

```<code>Data Frame
R1  R2  R3
A   A1  125
A   A2  250
A   A3  500
A   A4  75
A   A5  50
B   B1  250
B   B2  75
B   B3  125
B   B4  50
B   B5  0
C   C1  25
C   C2  125
C   C3  75
C   C4  5
C   C5  20
D   D1  100
D   D2  50
D   D3  25
D   D4  20
D   D5  0

Output
Index   Row1 Row2   Row3  Row4  Row5
0       A           1000  55%
1            A3     500         50%
2            A2     250         25%
3            A1     125         13%
4            Other  125         13%
5       B           500   28%
6            B1     250         50%
7            B3     125         25%
8            B2     75          15%
9            Other  50          10%
10      C           250   14%
11           C2     125         50%
12           C3     75          30%
13           C1     25          10%
14           Other  25          10%
15      Other       55    3%
Row1 sums the R1 and sort it by highest value.
Row2 sorts R2 by highest value.
Row3 contains value
Row4 Percentage for Row1
Row5 Percentage for Row2
</code>```

Thanks for your help.

Title: Sort largest 3 out of Top 3 Python

Body:
I am new to Python. I am aiming to create an output to find the TOP 3 out of the TOP 3 sorted by the largest for each row. For each row I want to see a percentage distribution.

I looked through the MultiIndex  part. I am able to get some part of it, but would miss Index Number 0,5,10,15. Please see output.

Data Frame
R1  R2  R3
A   A1  125
A   A2  250
A   A3  500
A   A4  75
A   A5  50
B   B1  250
B   B2  75
B   B3  125
B   B4  50
B   B5  0
C   C1  25
C   C2  125
C   C3  75
C   C4  5
C   C5  20
D   D1  100
D   D2  50
D   D3  25
D   D4  20
D   D5  0

Output
Index   Row1 Row2   Row3  Row4  Row5
0       A           1000  55%
1            A3     500         50%
2            A2     250         25%
3            A1     125         13%
4            Other  125         13%
5       B           500   28%
6            B1     250         50%
7            B3     125         25%
8            B2     75          15%
9            Other  50          10%
10      C           250   14%
11           C2     125         50%
12           C3     75          30%
13           C1     25          10%
14           Other  25          10%
15      Other       55    3%
Row1 sums the R1 and sort it by highest value.
Row2 sorts R2 by highest value.
Row3 contains value
Row4 Percentage for Row1
Row5 Percentage for Row2

Thanks for your help.


问:
How to work with history.back() function in bootstrap tabs using jQuery in asp.net c#
I'm working with bootstrap tabs in my web page and I have used this below online CDN links

CSS link (used at header)   :-  https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css

JS  script (used at end of the body logic) :-  https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js

And aspx and jQuery code is :-

```<code>
<head runat="server">
    <title></title>
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

     <link href=" https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" />
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>

   <%-- <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
    <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>--%>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/jquery.validate.min.js"></script>

    <script type="text/javascript">

        $(document).ready(function () {

        });

        function tradercommonbackclick() {

            //alert('click');

            window.history.back();

            //$(".scannersbackbtn").on("click", function (event) {
            //  //alert('hit');
            //  event.preventDefault();
            //   //history.back(1);
            //   history.back();
            //});

        }

    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div>

            <div class="col-md-12">

                <ul class="eqportmenus tradermenus nav">
                    <li class="active" data-bs-toggle="tab" data-bs-target="#nav-breakOut"><a href="#breakout">Break Out</a></li>
                    <li data-bs-toggle="tab" data-bs-target="#nav-momentum"><a href="#momentum">Momentum</a></li>
                    <li data-bs-toggle="tab" data-bs-target="#nav-reversion"><a href="#meanreversion">Mean Reversion</a></li>
                    <li data-bs-toggle="tab" data-bs-target="#nav-trendReversal"><a href="#trendreversal">Trend Reversal</a></li>
                    <li data-bs-toggle="tab" data-bs-target="#nav-gainersLosers"><a href="#gainerslosers">Gainers/Losers</a></li>
                    <li data-bs-toggle="tab" data-bs-target="#nav-custom"><a href="#custom">Custom</a></li>
                </ul>
            </div>

            <div>
                <div>
                    <a class="static_backbtn scannersbackbtn" onclick="tradercommonbackclick();"><i class="fa fa-angle-left" aria-hidden="true"></i>Back</a>
                </div>

                <div class="tab-pane fade" id="nav-breakOut" role="tabpanel" aria-labelledby="nav-break-tab">
                    <p>Break Out</p>
                </div>

                <div class="tab-pane fade" id="nav-momentum" role="tabpanel" aria-labelledby="nav-momentum-tab">
                    <p>Momentum</p>
                </div>
                <div class="tab-pane fade" id="nav-reversion" role="tabpanel" aria-labelledby="nav-mean-tab">
                    <p>Mean Reversion</p>
                </div>

                <div class="tab-pane fade" id="nav-trendReversal" role="tabpanel" aria-labelledby="nav-trend-tab">
                    <p>Trend Reversal</p>
                </div>

                <div class="tab-pane fade" id="nav-gainersLosers" role="tabpanel" aria-labelledby="nav-gl-tab">
                    <p>Gainers/Losers</p>
                </div>

                <div class="tab-pane fade" id="nav-custom" role="tabpanel" aria-labelledby="nav-contact-tab">
                    <p>Contact</p>
                </div>
            </div>

            <%--<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>--%>

        </div>
    </form>
</body>

</code>```

So here I'm using the Back a tag for going back of previously clicked tabs using history.back() jQuery logic

And I'm calling this tradercommonbackclick() method at a tag onclick event but my logic is not working properly

Suggest me how to achieve this bootstrap tab load using history.back().

Or is there any best way to achieve this ?

Note :- My query is if I click on the Break Out and Trend Reversal tabs and next if I click on the  Back, the previous clicked tabs Break Out should load (like wise client clicked tabs should load)

Body:
I'm working with bootstrap tabs in my web page and I have used this below online CDN links

CSS link (used at header)   :-  https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css

JS  script (used at end of the body logic) :-  https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js

And aspx and jQuery code is :-

    <title></title>

     <link href=" https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" />

   <%-- <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
    --%>

    <form id="form1" runat="server">

Break Out

Momentum

Mean Reversion

Trend Reversal

Gainers/Losers

Custom

                    Back

Break Out

Momentum

Mean Reversion

Trend Reversal

Gainers/Losers

Contact

            <%----%>

    </form>

So here I'm using the Back a tag for going back of previously clicked tabs using history.back() jQuery logic

And I'm calling this tradercommonbackclick() method at a tag onclick event but my logic is not working properly

Suggest me how to achieve this bootstrap tab load using history.back().

Or is there any best way to achieve this ?

Note :- My query is if I click on the Break Out and Trend Reversal tabs and next if I click on the  Back, the previous clicked tabs Break Out should load (like wise client clicked tabs should load)


问:
The problem in running JS in jupyter notebook in vscode
I copy my code from the jupyter notebook to notebook in vscode(connect to the Node.js kernel)
and it has something wrong.

```<code>Failed to start the Kernel.
D:\Anaconda\node_modules\ijavascript\node_modules\node-gyp-build\index.js:60
  throw new Error('No native build was found for ' + target + '\n    loaded from: ' + dir + '\n')
  ^

Error: No native build was found for platform=win32 arch=x64 runtime=electron abi=108 uv=1 libc=glibc node=18.11.0
    loaded from: D:\Anaconda\node_modules\ijavascript\node_modules\zeromq

    at load.path (D:\Anaconda\node_modules\ijavascript\node_modules\node-gyp-build\index.js:60:9)
    at load (D:\Anaconda\node_modules\ijavascript\node_modules\node-gyp-build\index.js:22:30)
    at Object.<anonymous> (D:\Anaconda\node_modules\ijavascript\node_modules\zeromq\binding.js:1:43)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (D:\Anaconda\node_modules\ijavascript\node_modules\zeromq\lib\index.js:6:11)

Node.js v18.11.0.
View Jupyter log for further details.
</code>```

Because I'm a novice,I have no idea to solve this problem...

I have no idea for what to do next,and I just want to make this kernel useful enough for a learner.

Body:
I copy my code from the jupyter notebook to notebook in vscode(connect to the Node.js kernel)
and it has something wrong.

Failed to start the Kernel.
D:\Anaconda\node_modules\ijavascript\node_modules\node-gyp-build\index.js:60
  throw new Error('No native build was found for ' + target + '\n    loaded from: ' + dir + '\n')
  ^

Error: No native build was found for platform=win32 arch=x64 runtime=electron abi=108 uv=1 libc=glibc node=18.11.0
    loaded from: D:\Anaconda\node_modules\ijavascript\node_modules\zeromq

    at load.path (D:\Anaconda\node_modules\ijavascript\node_modules\node-gyp-build\index.js:60:9)
    at load (D:\Anaconda\node_modules\ijavascript\node_modules\node-gyp-build\index.js:22:30)
    at Object.<anonymous> (D:\Anaconda\node_modules\ijavascript\node_modules\zeromq\binding.js:1:43)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (D:\Anaconda\node_modules\ijavascript\node_modules\zeromq\lib\index.js:6:11)

Node.js v18.11.0.
View Jupyter log for further details.

Because I'm a novice,I have no idea to solve this problem...

I have no idea for what to do next,and I just want to make this kernel useful enough for a learner.


问:
springboot tool is not work in application.properties
in vscode, from some time ago i couldn't see that shortcut in application.properties.

i tryed googling and someting, but still not work ㅠ_ㅠ
so, i wrote here for help..

this is my output err(?)

```<code>
[Error - 오후 8:24:00] Request textDocument/definition failed.
 Message: Internal error.
 Code: -32603
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Illegal character in path at index 34: file:///C:/Users/swans/OneDrive/바탕 화면/스프링 db/ojdbc/jdbc/src/main/resources/application.properties
   at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
   at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
   at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
   at java.base/java.util.concurrent.CompletableFuture$Completion.run(Unknown Source)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 34: file:///C:/Users/swans/OneDrive/바탕 화면/스프링 db/ojdbc/jdbc/src/main/resources/application.properties
   at java.base/java.net.URI.create(Unknown Source)
   at org.springframework.ide.vscode.boot.jdt.ls.JdtLsProjectCache.find(JdtLsProjectCache.java:197)
   at org.springframework.ide.vscode.boot.app.BootLanguageServerParams.lambda$createDefault$1(BootLanguageServerParams.java:76)
   at org.springframework.ide.vscode.boot.app.PropertiesJavaDefinitionHandler.handle(PropertiesJavaDefinitionHandler.java:68)
   at org.springframework.ide.vscode.languageserver.starter.LanguageServerAutoConf.lambda$registerDefinitionHandler$2(LanguageServerAutoConf.java:99)
   at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.lambda$definition$6(SimpleTextDocumentService.java:370)
   ... 5 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 34: file:///C:/Users/swans/OneDrive/바탕 화면/스프링 db/ojdbc/jdbc/src/main/resources/application.properties
   at java.base/java.net.URI$Parser.fail(Unknown Source)
   at java.base/java.net.URI$Parser.checkChars(Unknown Source)
   at java.base/java.net.URI$Parser.parseHierarchical(Unknown Source)
   at java.base/java.net.URI$Parser.parse(Unknown Source)
   at java.base/java.net.URI.<init>(Unknown Source)
   ... 11 more

</code>```

Body:
in vscode, from some time ago i couldn't see that shortcut in application.properties.

i tryed googling and someting, but still not work ㅠ_ㅠ
so, i wrote here for help..

this is my output err(?)

[Error - 오후 8:24:00] Request textDocument/definition failed.
 Message: Internal error.
 Code: -32603
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Illegal character in path at index 34: file:///C:/Users/swans/OneDrive/바탕 화면/스프링 db/ojdbc/jdbc/src/main/resources/application.properties
   at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
   at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
   at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
   at java.base/java.util.concurrent.CompletableFuture$Completion.run(Unknown Source)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 34: file:///C:/Users/swans/OneDrive/바탕 화면/스프링 db/ojdbc/jdbc/src/main/resources/application.properties
   at java.base/java.net.URI.create(Unknown Source)
   at org.springframework.ide.vscode.boot.jdt.ls.JdtLsProjectCache.find(JdtLsProjectCache.java:197)
   at org.springframework.ide.vscode.boot.app.BootLanguageServerParams.lambda$createDefault$1(BootLanguageServerParams.java:76)
   at org.springframework.ide.vscode.boot.app.PropertiesJavaDefinitionHandler.handle(PropertiesJavaDefinitionHandler.java:68)
   at org.springframework.ide.vscode.languageserver.starter.LanguageServerAutoConf.lambda$registerDefinitionHandler$2(LanguageServerAutoConf.java:99)
   at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.lambda$definition$6(SimpleTextDocumentService.java:370)
   ... 5 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 34: file:///C:/Users/swans/OneDrive/바탕 화면/스프링 db/ojdbc/jdbc/src/main/resources/application.properties
   at java.base/java.net.URI$Parser.fail(Unknown Source)
   at java.base/java.net.URI$Parser.checkChars(Unknown Source)
   at java.base/java.net.URI$Parser.parseHierarchical(Unknown Source)
   at java.base/java.net.URI$Parser.parse(Unknown Source)
   at java.base/java.net.URI.<init>(Unknown Source)
   ... 11 more


问:
I have to finetune the below query in Postgres its taking time for fetching the data, can you help Me?
```<code>select to_char(ts."SubmittedDate", 'YYYY-MM') as "monthYear",
       MIN(ts."TimeEntryID") as "TimeEntryID",
       SUM(ts."SpentTime") as "TotalHours",
       MAX(ts."CreatedOn") as "CreatedOn",
       ts."ApplicationID",
       ts."TSTypeCodeID",
       rcv."CodeName" as TSType,
       ts."UserID",
       ts."StatusID",
       st."Status"
from task_management_v1."TimeSheet" ts
   left join task_management_v1."Status" st
      on ts."StatusID" = st."ID"
   left join task_management_v1."RefCodeValue" rcv
      on ts."TSTypeCodeID" = rcv."CodeValueID"
   left join task_management_v1."Users" u
      on ts."ApplicationID" = u."ApplicationID" and ts."UserID" = u."UserID"
where ts."ApplicationID" = 34
  and ts."UserID" in ('YXR4318','KXL5356','BXB0448')
  and ts."StatusID" in ( 47,44,45,46)
  and ts."SubmittedDate" > CURRENT_DATE - INTERVAL '3 months'
group by ts."UserID" ,
         ts."StatusID" ,
         ts."ApplicationID",
         1,
         st."Status",
         ts."TSTypeCodeID",
         TSType
order by 4 desc
limit 25 offset 0;
</code>```

I tried with a CTE, but I am getting duplicates.

Body:
select to_char(ts."SubmittedDate", 'YYYY-MM') as "monthYear",
       MIN(ts."TimeEntryID") as "TimeEntryID",
       SUM(ts."SpentTime") as "TotalHours",
       MAX(ts."CreatedOn") as "CreatedOn",
       ts."ApplicationID",
       ts."TSTypeCodeID",
       rcv."CodeName" as TSType,
       ts."UserID",
       ts."StatusID",
       st."Status"
from task_management_v1."TimeSheet" ts
   left join task_management_v1."Status" st
      on ts."StatusID" = st."ID"
   left join task_management_v1."RefCodeValue" rcv
      on ts."TSTypeCodeID" = rcv."CodeValueID"
   left join task_management_v1."Users" u
      on ts."ApplicationID" = u."ApplicationID" and ts."UserID" = u."UserID"
where ts."ApplicationID" = 34
  and ts."UserID" in ('YXR4318','KXL5356','BXB0448')
  and ts."StatusID" in ( 47,44,45,46)
  and ts."SubmittedDate" > CURRENT_DATE - INTERVAL '3 months'
group by ts."UserID" ,
         ts."StatusID" ,
         ts."ApplicationID",
         1,
         st."Status",
         ts."TSTypeCodeID",
         TSType
order by 4 desc
limit 25 offset 0;

I tried with a CTE, but I am getting duplicates.


问:
Don't sanitize HTML when inserting text from MS Access Into SQL Database
My Application is basically an Access front end with a sql database in the backend.

I have a textfield in which i can write text. If i put new lines there, I can see that in the SQL database, there is a  inserted for formatting.

BUT when i write a  there, the  is sanitized and thus not displayed correctly later on.

Example:

```<code>eins
absatz
custom <div></div>
</code>```

is saved as

eins

absatz

custom

I actually don't know how to prevent that from happening, it seems like acces is doint that automatecally.

The access is version 2016 and the sql server is a mcrosoft SQL server Developer

My goal was the the user could type his own HTML for formatting for example
 and then this HTML is stored normally as the autogenrated html in the database, to be displayed correctly when exporting data to pdf.

Body:
My Application is basically an Access front end with a sql database in the backend.

I have a textfield in which i can write text. If i put new lines there, I can see that in the SQL database, there is a  inserted for formatting.

BUT when i write a  there, the  is sanitized and thus not displayed correctly later on.

Example:

eins
absatz
custom

is saved as

eins

absatz

custom

I actually don't know how to prevent that from happening, it seems like acces is doint that automatecally.

The access is version 2016 and the sql server is a mcrosoft SQL server Developer

My goal was the the user could type his own HTML for formatting for example
 and then this HTML is stored normally as the autogenrated html in the database, to be displayed correctly when exporting data to pdf.


问:
Sharing callbacks globally in React?
I have a custom hook that returns a callback function:

```<code>const {scrollToComponent} = useVisibilityHandler(ref);
</code>```

Now I want to store this callback in such a way that it should be accessible to some other Component too:

```<code>// Header.tsx
const Header = () => {
    // I need to access the callback created in the above function here.
}
</code>```

Since State management tools strongly discourage storing callbacks due to their non serializable nature I want to know what is the best practice followed to share callbacks globally among different functional components.

Title: Sharing callbacks globally in React?

Body:
I have a custom hook that returns a callback function:

const {scrollToComponent} = useVisibilityHandler(ref);

Now I want to store this callback in such a way that it should be accessible to some other Component too:

// Header.tsx
const Header = () => {
    // I need to access the callback created in the above function here.
}

Since State management tools strongly discourage storing callbacks due to their non serializable nature I want to know what is the best practice followed to share callbacks globally among different functional components.


问:
Is there a way to connect a .net-core app in docker container to docker-kubernates instance?
I am working on an app where all our code is in .NET-core API. When I create the container it contains my app plus the NuGet (custom package). This app is dependent on consul which is deployed on Kubernetes on the same system. When I run the code in debug mode it works fine but when I run it with docker support it gives me an error when it hits the code where the consul is referred.

I have tried accessing it with different port settings (pod and service). It is still giving me error.


问:
Integrate Spring Security SAML2 Extension in Strut2 web application
I have a struts2 web application which use Spring Security SAML2 (Spring source) http://springsource.org/spring-security-saml) to get authentication of users in an external system AD FS.

I use spring-security-saml war as intermediary between Struts2 and external system AD FS for use the SAML2 protocol.

We currently have two different "Service Providers":

Struts2 application that does not directly use the SAML2 protocol but delegates it to the "spring-security-saml2-war" by starting on a particular route/url of this

"spring-security-saml2-war" which exactly follows the "SP-initiated" SAML2 flow I reported below and which at the end goto to my login Success Action of Struts2

"SP-initiated" SAML2 flow

Is it possible integrate all code of SAML2 Spring source in my struts2 project?

Thank a lots :-)

I would like to use the SAML2 protocol between in my Struts2 web application without using external war spring-security-saml2, the code of this war managed entirely in the Struts2 project


问:
GSAP import error: 'node_modules/@gsap/business/types/index.d.ts' is not a module
G'day SO!

I am getting a persistent error in my Vite + React + GSAP + TypeScript environment on attempted import in all tsx files that require it: 'node_modules/@gsap/business/types/index.d.ts' is not a module.

```<code>{
  "compilerOptions": {
    ...
  },
  "files": [
    "./node_modules/@gsap/business/types/index.d.ts"
  ]
}
</code>```

Has been added to tsconfig.json & problem still continues.

Import is:

```<code>import { gsap } from '@gsap/business'
</code>```

What am I overlooking here?

Body:
G'day SO!

I am getting a persistent error in my Vite + React + GSAP + TypeScript environment on attempted import in all tsx files that require it: 'node_modules/@gsap/business/types/index.d.ts' is not a module.

{
  "compilerOptions": {
    ...
  },
  "files": [
    "./node_modules/@gsap/business/types/index.d.ts"
  ]
}

Has been added to tsconfig.json & problem still continues.

Import is:

import { gsap } from '@gsap/business'

What am I overlooking here?


问:
Hidden state output from jags model in R
Does the "jags" function of R2jags give estimated states output when estimating a state space model?

Or is it to be derived manually using estimated mean/medians of parameter values.


问:
CMB2 data not showing in single page, where already define another post type
I have a project which have a custom single post type. Here already have a different post type data call.

Here is the code:

```<code><section class="services py-3 py-md-5 bg-orange">
    <div class="container">
        <div class="col-lg-4 col-md-6 px-4 py-2 py-md-4 sr-col service-sm">
            <div class="sr-border">
                <h2 class="text-center fm-20 text-white fw-bold other-title pe-0 pe-md-2"><?php echo show('banner_title');?></h2>
                <p class="text-center fm-15 fw-bold text-white pe-2"><?php echo show('innerList_subtitle');?></p>
            </div>
        </div>
        <div id="service-box-md" class="row">
            <div class="col-lg-4 col-md-6 px-4 py-2 py-md-4 sr-col">
                <div class="sr-border">
                    <h2 class="fm-18 text-white fw-bold other-title pe-0 pe-md-2"><?php echo show('banner_title');?></h2>

                    <p class="fm-15 fw-bold text-white pe-2"><?php echo show('innerList_subtitle');?></p>
                </div>
            </div>
            <?php
            $count_num = count($redux_demo['service_card_title']);
            for ($x = 0; $x < $count_num; $x++) {
            ?>
            <div class="col-lg-4 col-md-6 px-4 py-2 py-md-4 sr-col">
                <div class="sr-border">
                    <h2 class="fm-18 fw-semibold fs-34 fw-semibold text-white pt-1 pt-md-3 mb-2 mb-md-5"><?php echo $redux_demo['service_card_title'][$x];?></h2>
                    <p class="fm-15 text-white pe-2">
                        <?php echo $redux_demo['service_card_des'][$x];?>
                    </p>
                </div>
            </div>
            <?php } ?>
        </div>
        <div id="service-box-sm" class="row mobileSliderService">
            <?php
            $count_num = count($redux_demo['service_card_title']);
            for ($x = 0; $x < $count_num; $x++) {
            ?>
            <div class="col-lg-4 col-md-6 px-4 py-2 py-md-4 sr-col">
                <div class="sr-border">
                    <h2 class="fm-18 fw-semibold fs-34 fw-semibold text-white pt-1 pt-md-3 mb-2 mb-md-5"><?php echo $redux_demo['service_card_title'][$x];?></h2>
                    <p class="fm-15 text-white pe-2 pb-3">
                        <?php echo $redux_demo['service_card_des'][$x];?>
                    </p>
                </div>
            </div>
            <?php } ?>
        </div>
    </div>
</section>

<?php echo get_post_meta( get_the_ID(), "banner_title", true )?>
</code>```

Here the custom meta box data not showing. Is there any solutions?

I tired to show CMB2 custom metabox data on this single page.

Body:
I have a project which have a custom single post type. Here already have a different post type data call.

Here is the code:

<?php echo show('banner_title');?>

<?php echo show('innerList_subtitle');?>

<?php echo show('banner_title');?>

<?php echo show('innerList_subtitle');?>

            <?php
            $count_num = count($redux_demo['service_card_title']);
            for ($x = 0; $x < $count_num; $x++) {
            ?>

<?php echo $redux_demo['service_card_title'][$x];?>

                        <?php echo $redux_demo['service_card_des'][$x];?>

            <?php } ?>

            <?php
            $count_num = count($redux_demo['service_card_title']);
            for ($x = 0; $x < $count_num; $x++) {
            ?>

<?php echo $redux_demo['service_card_title'][$x];?>

                        <?php echo $redux_demo['service_card_des'][$x];?>

            <?php } ?>

<?php echo get_post_meta( get_the_ID(), "banner_title", true )?>

Here the custom meta box data not showing. Is there any solutions?

I tired to show CMB2 custom metabox data on this single page.


问:
module 'cython' has no attribute 'annotation_typing'
I just recently updated Cython from 0.29.24 to 3.0.0a11 and I was getting compilation errors due to functions that were using Dict type hints.  With the previous versions, I never had any issues of this type (no pun intended). I compile my entire python project by building Extensions using cythonize in a setup.py file.  I am using Python 3.9.13.

After doing some reading I attempted to solve the issues I was having by using the compiler directive as follows:

```<code>import cython

@cython.annotation_typing(False)
def my_function_with_type_hints(this_object: Dict) -> Dict:
   pass
</code>```

Compilation succeeded although I have not tested my compiled code yet.  I returned to development to test some new code and now I am unable to run code in interpeter mode because Cython is complaining "module 'cython' has no attribute 'annotation_typing'".  I confirmed (via pip freeze) that Cython==3.0.0a11 is installed in my environment and that my environment is activated (in vscode).

My questions:

Did I fix the typing issue correctly using the compiler directive or am I not understanding the problem fully?

How should I be using compiler directives in interpreter mode? Do I need another decorator that conditionally includes the cython directive?

Thank you in advance for any help!

Body:
I just recently updated Cython from 0.29.24 to 3.0.0a11 and I was getting compilation errors due to functions that were using Dict type hints.  With the previous versions, I never had any issues of this type (no pun intended). I compile my entire python project by building Extensions using cythonize in a setup.py file.  I am using Python 3.9.13.

After doing some reading I attempted to solve the issues I was having by using the compiler directive as follows:

import cython

@cython.annotation_typing(False)
def my_function_with_type_hints(this_object: Dict) -> Dict:
   pass

Compilation succeeded although I have not tested my compiled code yet.  I returned to development to test some new code and now I am unable to run code in interpeter mode because Cython is complaining "module 'cython' has no attribute 'annotation_typing'".  I confirmed (via pip freeze) that Cython==3.0.0a11 is installed in my environment and that my environment is activated (in vscode).

My questions:

Did I fix the typing issue correctly using the compiler directive or am I not understanding the problem fully?

How should I be using compiler directives in interpreter mode? Do I need another decorator that conditionally includes the cython directive?

Thank you in advance for any help!


问:
Tabelau - how to avoid filter value for particular sheet
I have been using tabcmd to export the dashboard as a pdf. I want to apply a filter for a particular sheet only but tabcmd applies the filter values to all sheets

tabcmd export Store-TestCompany/Sales?Location%20Id=472

1)sheet_1

2)sheet_2

3)sheet_3

for example, tamcmd shouldn't apply the filter value to sheet_1, is there any way to avoid filter for sheet_1


问:
Creating pixel perfect html/css pages for Syncfusion html to pdf to have exactly a4 pages in pdf
I am trying to convert html to pdf using SyncFusion html to pdf converter.

```<code>HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
htmlConverter.RenderingEngine = HtmlRenderingEngine.Blink;
BlinkConverterSettings blinkSettings = new BlinkConverterSettings();
blinkSettings.EnableJavaScript = true;
blinkSettings.Margin = new PdfMargins
{
    Left = 25,
    Right = 25,
    Top = 30,
    Bottom = 30
};
blinkSettings.ViewPortSize = new Size(992, 0);

htmlConverter.ConverterSettings = blinkSettings;
...
</code>```

in css i am doing something like this

```<code>.page {
  min-height: 297mm;
  width: 210mm;
  margin: 0;
  padding: 0;
  page-break-after: right;
  position: relative;
}
</code>```

But in pdf sizes of .page not the same a4 size.
How can I have the same mm in html/css and in pdf?

Body:
I am trying to convert html to pdf using SyncFusion html to pdf converter.

HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
htmlConverter.RenderingEngine = HtmlRenderingEngine.Blink;
BlinkConverterSettings blinkSettings = new BlinkConverterSettings();
blinkSettings.EnableJavaScript = true;
blinkSettings.Margin = new PdfMargins
{
    Left = 25,
    Right = 25,
    Top = 30,
    Bottom = 30
};
blinkSettings.ViewPortSize = new Size(992, 0);

htmlConverter.ConverterSettings = blinkSettings;
...

in css i am doing something like this

.page {
  min-height: 297mm;
  width: 210mm;
  margin: 0;
  padding: 0;
  page-break-after: right;
  position: relative;
}

But in pdf sizes of .page not the same a4 size.
How can I have the same mm in html/css and in pdf?


问:
How do I remove adaptive behavior from the v-menu component?
I want to create an input field for the site where a search can be done using the v-text-field and the result will be displayed in the v-menu component.

The problem is that when the screen height is insufficient, the v-menu component covers the input field like this-

But I want it to be like this-

Here is my code-

```<code><v-text-field
  :items="..."
  v-model="..."
  ...
>
  <v-menu activator="parent">
    ...
  </v-menu>
</v-text-field>

</code>```

Body:
I want to create an input field for the site where a search can be done using the v-text-field and the result will be displayed in the v-menu component.

The problem is that when the screen height is insufficient, the v-menu component covers the input field like this-

But I want it to be like this-

Here is my code-

<v-text-field
  :items="..."
  v-model="..."
  ...
>
  <v-menu activator="parent">
    ...
  </v-menu>
</v-text-field>


问:
how to use IN parameter in where clause of select query of DB2 nodeJS
I am trying to use IN parameter in the WHERE clause of select query in IBM_DB2 of nodeJS.

I tried the following:

```<code>const conn = await ibmdb.open(connStr);
const query = 'SELECT NAMES FROM DB.TABLE WHERE SETUP_DATE > ? AND ID IN (?)';
const prepareSmt = await connection.prepare(query);
const result = await prepareSmt.execute(['230101', ['123','124','125']]);
const data = await result.fetchAllSync();
console.log("result = ", data);
</code>```

when the above gets executed: I always get error:

```<code>Error: Wrong param format!
    at /Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/odbc.js:1550:12
    at SimpleQueue.next (/Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/simple-queue.js:34:5)
    at SimpleQueue.maybeNext (/Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/simple-queue.js:22:10)
    at SimpleQueue.push (/Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/simple-queue.js:15:8)
    at ODBCStatement.odbc.ODBCStatement.execute (/Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/odbc.js:1524:14)
    at main (/Users/USERNAME/workspace/learning/ibmDB2/index.js:14:29)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
</code>```

The same query works when i use without IN parameter. Can someone please help me how to frame the query and pass the values when IN parameter used in the select query.

Using TOAD we are able to execute a query like this:
Select NAMES from DB.TABLE where SETUP_DATE > '230101' AND ID IN ('123','124','125')

And i am trying to execute the same from IBM_DB2 nodejs.

Thanks,
Naveen

Body:
I am trying to use IN parameter in the WHERE clause of select query in IBM_DB2 of nodeJS.

I tried the following:

const conn = await ibmdb.open(connStr);
const query = 'SELECT NAMES FROM DB.TABLE WHERE SETUP_DATE > ? AND ID IN (?)';
const prepareSmt = await connection.prepare(query);
const result = await prepareSmt.execute(['230101', ['123','124','125']]);
const data = await result.fetchAllSync();
console.log("result = ", data);

when the above gets executed: I always get error:

Error: Wrong param format!
    at /Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/odbc.js:1550:12
    at SimpleQueue.next (/Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/simple-queue.js:34:5)
    at SimpleQueue.maybeNext (/Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/simple-queue.js:22:10)
    at SimpleQueue.push (/Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/simple-queue.js:15:8)
    at ODBCStatement.odbc.ODBCStatement.execute (/Users/USERNAME/workspace/learning/ibmDB2/node_modules/ibm_db/lib/odbc.js:1524:14)
    at main (/Users/USERNAME/workspace/learning/ibmDB2/index.js:14:29)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

The same query works when i use without IN parameter. Can someone please help me how to frame the query and pass the values when IN parameter used in the select query.

Using TOAD we are able to execute a query like this:
Select NAMES from DB.TABLE where SETUP_DATE > '230101' AND ID IN ('123','124','125')

And i am trying to execute the same from IBM_DB2 nodejs.

Thanks,
Naveen


问:
How to detect application shutdown on Gluon mobile?
I would like to run some Java code when users stop the application on mobiles, for example to save some data when they swipe up the app. I tried Runtime.getRuntime().addShutdownHook(Runnable) but the runnable is not called. I looked at Gluon attach lifecycle module with LifecycleService.addListener(LifecycleEvent, Runnable) but LifecycleEvent only accepts PAUSE or RESUME, not STOP. So how can I achieve this?