问:
Vercel deployment failed
I deployed my react app over Vercel one month ago but recently, after a push (no major code changes), Vercel failed to deploy my application.

I am new to Vercel and not getting what's wrong earlier it was working fine but now it's throwing an error - Build Failed Command "yarn run build" exited with 1

here are the complete logs-

```<code>[17:33:50.666] Cloning github.com/Myrepolink (Branch: main, Commit: c1ba5..)
[17:33:50.813] Previous build cache not available
[17:33:52.278] Cloning completed: 1.611s
[17:33:52.537] Running "vercel build"
[17:33:53.181] Vercel CLI 28.8.0
[17:33:53.931] Warning: Due to "engines": { "node": "14 || 15 || 16" } in your `package.json` file, the Node.js Version defined in your Project Settings ("18.x") will not apply. Learn More: http://vercel.link/node-version
[17:33:53.936] Installing dependencies...
[17:33:54.368] yarn install v1.22.17
[17:33:54.430] info No lockfile found.
[17:33:54.439] [1/5] Validating package.json...
[17:33:54.443] [2/5] Resolving packages...
[17:33:58.556] warning @testing-library/jest-dom > css > source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
[17:34:03.125] warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
[17:34:04.173] warning react-scripts > workbox-webpack-plugin > workbox-build > rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
[17:34:04.362] warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
[17:34:04.482] warning react-scripts > css-minimizer-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
[17:34:05.170] warning react-scripts > workbox-webpack-plugin > workbox-build > @surma/rollup-plugin-off-main-thread > magic-string > sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
[17:34:05.291] warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
[17:34:05.831] [3/5] Fetching packages...
[17:34:45.957] [4/5] Linking dependencies...
[17:34:45.961] warning "@emotion/styled > @emotion/babel-plugin@11.10.5" has unmet peer dependency "@babel/core@^7.0.0".
[17:34:45.961] warning "@emotion/styled > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.18.6" has unmet peer dependency "@babel/core@^7.0.0-0".
[17:34:45.963] warning " > @react-jvectormap/core@1.0.1" has unmet peer dependency "jquery@^3.6.0".
[17:34:45.964] warning " > @testing-library/user-event@13.5.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".
[17:34:45.964] warning " > bootstrap@5.2.3" has unmet peer dependency "@popperjs/core@^2.11.6".
[17:34:45.965] warning " > react-quill@1.3.5" has incorrect peer dependency "react@^0.14.9 || ^15.3.0 || ^16.0.0".
[17:34:45.969] warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
[17:34:45.969] warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
[17:34:45.973] warning "react-scripts > react-dev-utils > fork-ts-checker-webpack-plugin@6.5.2" has unmet peer dependency "typescript@>= 2.7".
[17:34:45.980] warning "react-scripts > eslint-config-react-app > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[17:35:08.675] [5/5] Building fresh packages...
[17:35:09.929] success Saved lockfile.
[17:35:09.936] Done in 75.57s.
[17:35:10.024] Running "yarn run build"
[17:35:10.315] yarn run v1.22.17
[17:35:10.374] $ react-scripts build
[17:35:11.884] Creating an optimized production build...
[17:35:43.751] Failed to compile.
[17:35:43.751]
[17:35:43.752] export 'experimental_sx' (reexported as 'experimental_sx') was not found in '@mui/system' (possible exports: Box, Container, GlobalStyles, Stack, StyledEngineProvider, ThemeProvider, Unstable_Grid, alignContent, alignItems, alignSelf, alpha, backgroundColor, bgcolor, border, borderBottom, borderBottomColor, borderColor, borderLeft, borderLeftColor, borderRadius, borderRight, borderRightColor, borderTop, borderTopColor, borderTransform, borders, bottom, boxSizing, breakpoints, color, colorChannel, columnGap, compose, containerClasses, createBox, createBreakpoints, createContainer, createGrid, createSpacing, createStack, createStyled, createTheme, createUnarySpacing, createUnaryUnit, css, darken, decomposeColor, display, emphasize, flex, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, flexbox, fontFamily, fontSize, fontStyle, fontWeight, gap, getContainerUtilityClass, getContrastRatio, getGridUtilityClass, getLuminance, getPath, getStackUtilityClass, getStyleFromPropValue, getStyleValue, getThemeProps, getValue, grid, gridArea, gridAutoColumns, gridAutoFlow, gridAutoRows, gridClasses, gridColumn, gridRow, gridTemplateAreas, gridTemplateColumns, gridTemplateRows, handleBreakpoints, height, hexToRgb, hslToRgb, justifyContent, justifyItems, justifySelf, keyframes, left, letterSpacing, lighten, lineHeight, margin, marginKeys, maxHeight, maxWidth, mergeBreakpointsInOrder, minHeight, minWidth, order, padding, paddingKeys, palette, paletteTransform, position, positions, private_safeAlpha, private_safeColorChannel, private_safeDarken, private_safeEmphasize, private_safeLighten, recomposeColor, responsivePropType, rgbToHex, right, rowGap, shadows, shape, shouldForwardProp, sizeHeight, sizeWidth, sizing, sizingTransform, spacing, stackClasses, style, styled, systemDefaultTheme, textAlign, textTransform, top, typography, typographyVariant, unstable_createCssVarsProvider, unstable_createGetCssVar, unstable_createStyleFunctionSx, unstable_defaultSxConfig, unstable_extendSxProp, unstable_getThemeValue, unstable_resolveBreakpointValues, unstable_styleFunctionSx, useTheme, useThemeProps, useThemeWithoutDefault, width, zIndex)
[17:35:43.753]
[17:35:43.754]
[17:35:43.804] error Command failed with exit code 1.
[17:35:43.804] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[17:35:43.823] Error: Command "yarn run build" exited with 1
</code>```

anyone can please help me?

Title: Vercel deployment failed

Body:
I deployed my react app over Vercel one month ago but recently, after a push (no major code changes), Vercel failed to deploy my application.

I am new to Vercel and not getting what's wrong earlier it was working fine but now it's throwing an error - Build Failed Command "yarn run build" exited with 1

here are the complete logs-

[17:33:50.666] Cloning github.com/Myrepolink (Branch: main, Commit: c1ba5..)
[17:33:50.813] Previous build cache not available
[17:33:52.278] Cloning completed: 1.611s
[17:33:52.537] Running "vercel build"
[17:33:53.181] Vercel CLI 28.8.0
[17:33:53.931] Warning: Due to "engines": { "node": "14 || 15 || 16" } in your `package.json` file, the Node.js Version defined in your Project Settings ("18.x") will not apply. Learn More: http://vercel.link/node-version
[17:33:53.936] Installing dependencies...
[17:33:54.368] yarn install v1.22.17
[17:33:54.430] info No lockfile found.
[17:33:54.439] [1/5] Validating package.json...
[17:33:54.443] [2/5] Resolving packages...
[17:33:58.556] warning @testing-library/jest-dom > css > source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
[17:34:03.125] warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
[17:34:04.173] warning react-scripts > workbox-webpack-plugin > workbox-build > rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
[17:34:04.362] warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
[17:34:04.482] warning react-scripts > css-minimizer-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
[17:34:05.170] warning react-scripts > workbox-webpack-plugin > workbox-build > @surma/rollup-plugin-off-main-thread > magic-string > sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
[17:34:05.291] warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
[17:34:05.831] [3/5] Fetching packages...
[17:34:45.957] [4/5] Linking dependencies...
[17:34:45.961] warning "@emotion/styled > @emotion/babel-plugin@11.10.5" has unmet peer dependency "@babel/core@^7.0.0".
[17:34:45.961] warning "@emotion/styled > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.18.6" has unmet peer dependency "@babel/core@^7.0.0-0".
[17:34:45.963] warning " > @react-jvectormap/core@1.0.1" has unmet peer dependency "jquery@^3.6.0".
[17:34:45.964] warning " > @testing-library/user-event@13.5.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".
[17:34:45.964] warning " > bootstrap@5.2.3" has unmet peer dependency "@popperjs/core@^2.11.6".
[17:34:45.965] warning " > react-quill@1.3.5" has incorrect peer dependency "react@^0.14.9 || ^15.3.0 || ^16.0.0".
[17:34:45.969] warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
[17:34:45.969] warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
[17:34:45.973] warning "react-scripts > react-dev-utils > fork-ts-checker-webpack-plugin@6.5.2" has unmet peer dependency "typescript@>= 2.7".
[17:34:45.980] warning "react-scripts > eslint-config-react-app > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[17:35:08.675] [5/5] Building fresh packages...
[17:35:09.929] success Saved lockfile.
[17:35:09.936] Done in 75.57s.
[17:35:10.024] Running "yarn run build"
[17:35:10.315] yarn run v1.22.17
[17:35:10.374] $ react-scripts build
[17:35:11.884] Creating an optimized production build...
[17:35:43.751] Failed to compile.
[17:35:43.751]
[17:35:43.752] export 'experimental_sx' (reexported as 'experimental_sx') was not found in '@mui/system' (possible exports: Box, Container, GlobalStyles, Stack, StyledEngineProvider, ThemeProvider, Unstable_Grid, alignContent, alignItems, alignSelf, alpha, backgroundColor, bgcolor, border, borderBottom, borderBottomColor, borderColor, borderLeft, borderLeftColor, borderRadius, borderRight, borderRightColor, borderTop, borderTopColor, borderTransform, borders, bottom, boxSizing, breakpoints, color, colorChannel, columnGap, compose, containerClasses, createBox, createBreakpoints, createContainer, createGrid, createSpacing, createStack, createStyled, createTheme, createUnarySpacing, createUnaryUnit, css, darken, decomposeColor, display, emphasize, flex, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, flexbox, fontFamily, fontSize, fontStyle, fontWeight, gap, getContainerUtilityClass, getContrastRatio, getGridUtilityClass, getLuminance, getPath, getStackUtilityClass, getStyleFromPropValue, getStyleValue, getThemeProps, getValue, grid, gridArea, gridAutoColumns, gridAutoFlow, gridAutoRows, gridClasses, gridColumn, gridRow, gridTemplateAreas, gridTemplateColumns, gridTemplateRows, handleBreakpoints, height, hexToRgb, hslToRgb, justifyContent, justifyItems, justifySelf, keyframes, left, letterSpacing, lighten, lineHeight, margin, marginKeys, maxHeight, maxWidth, mergeBreakpointsInOrder, minHeight, minWidth, order, padding, paddingKeys, palette, paletteTransform, position, positions, private_safeAlpha, private_safeColorChannel, private_safeDarken, private_safeEmphasize, private_safeLighten, recomposeColor, responsivePropType, rgbToHex, right, rowGap, shadows, shape, shouldForwardProp, sizeHeight, sizeWidth, sizing, sizingTransform, spacing, stackClasses, style, styled, systemDefaultTheme, textAlign, textTransform, top, typography, typographyVariant, unstable_createCssVarsProvider, unstable_createGetCssVar, unstable_createStyleFunctionSx, unstable_defaultSxConfig, unstable_extendSxProp, unstable_getThemeValue, unstable_resolveBreakpointValues, unstable_styleFunctionSx, useTheme, useThemeProps, useThemeWithoutDefault, width, zIndex)
[17:35:43.753]
[17:35:43.754]
[17:35:43.804] error Command failed with exit code 1.
[17:35:43.804] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[17:35:43.823] Error: Command "yarn run build" exited with 1

anyone can please help me?


来源: stackexchange

问:
Does play2-reactivemongo v.0.18 support MongoDB 5?
Is there any info which version of MongoDB is supported by each version of Reactive Scala Driver (play2-reactivemongo)?

I need to upgrade MongoDB and wondering if current implementation with play2-reactivemongo v.0.18  will require upgrade too.

ContentLicense: CC BY-SA 4.0


问:
How to send smtp email using python django project in cpanel?
When tried to send email using smtp in cpanel but so error
error: [Errno 111] Connection refused.

Here is my code in django

view.py

```<code>    subject = 'Requested For Application Form'
    message = f'Email successfully send'
    email_from = settings.EMAIL_HOST_USER
    recipient_list = ['bedag12032@fanneat.com']
    send_mail(subject, message, email_from,recipient_list,fail_silently=False)
    return redirect('/home')
</code>```

setting.py

```<code>    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
    EMAIL_HOST = 'smtpout.secureserver.net'
    EMAIL_USE_TLS = True
    EMAIL_PORT = 465
    EMAIL_HOST_USER = 'pematep658@lubde.com'
    EMAIL_HOST_PASSWORD = 'okoik9sa54as'
</code>```

Tried to send email using smtp in cpanel in python django but error  [Errno 111] Connection refused.

Body:
When tried to send email using smtp in cpanel but so error
error: [Errno 111] Connection refused.

Here is my code in django

view.py

    subject = 'Requested For Application Form'
    message = f'Email successfully send'
    email_from = settings.EMAIL_HOST_USER
    recipient_list = ['bedag12032@fanneat.com']
    send_mail(subject, message, email_from,recipient_list,fail_silently=False)
    return redirect('/home')

setting.py

    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
    EMAIL_HOST = 'smtpout.secureserver.net'
    EMAIL_USE_TLS = True
    EMAIL_PORT = 465
    EMAIL_HOST_USER = 'pematep658@lubde.com'
    EMAIL_HOST_PASSWORD = 'okoik9sa54as'

Tried to send email using smtp in cpanel in python django but error  [Errno 111] Connection refused.


问:
Why does categories array in function setupAndStart not printing anything to console?
I have a function called setupAndStart(). Within that function I am calling getCategoryIds() to get an array of category ids. Then, I am passing each element in the array to getCategory(id) to get an object and pushing the returned valued to categories array.

However, when I try to loop through the categories array and print each element I don't get any results.

const URL = `https://jservice.io/api`;
const NUM_QUESTIONS = 5;
const NUM_CATEGORIES = 6;

// categories is the main data structure for the app; it looks like this:

//  [
//    { title: "Math",
//      clues: [
//        {question: "2+2", answer: 4, showing: null},
//        {question: "1+1", answer: 2, showing: null}
//        ...
//      ],
//    },
//    { title: "Literature",
//      clues: [
//        {question: "Hamlet Author", answer: "Shakespeare", showing: null},
//        {question: "Bell Jar Author", answer: "Plath", showing: null},
//        ...
//      ],
//    },
//    ...
//  ]

let categories = [];

/** Get NUM_CATEGORIES random category from API.
 *
 * Returns array of category ids
 */

async function getCategoryIds() {
  let response = await axios.get(`${URL}/categories`, {
    params: { count: "100", offset: 20 },
  });

  let randomCategory = _.sampleSize(response.data, NUM_CATEGORIES);
  let categoryIDs = randomCategory.map((item) => {
    return item.id;
  });

  return categoryIDs;
}

/** Return object with data about a category:
 *
 *  Returns { title: "Math", clues: clue-array }
 *
 * Where clue-array is:
 *   [
 *      {question: "Hamlet Author", answer: "Shakespeare", showing: null},
 *      {question: "Bell Jar Author", answer: "Plath", showing: null},
 *      ...
 *   ]
 */

async function getCategory(catId) {
  let response = await axios.get(`${URL}/clues`, {
    params: { category: catId },
  });

  let fiveClues = _.sampleSize(response.data, NUM_QUESTIONS);

  let questionAnswerArray = fiveClues.map((arr) => {
    return {
      question: arr.question,
      answer: arr.answer,
      showing: null,
    };
  });

  let titleClueObj = {
    title: fiveClues[0].category.title,
    clues: questionAnswerArray,
  };
  return titleClueObj;
}

/** Fill the HTML table#jeopardy with the categories & cells for questions.
 *
 * - The
 should be filled w/a
, and a  for each category
 * - The
 should be filled w/NUM_QUESTIONS_PER_CAT
s,
 *   each with a question for each category in a
 *   (initally, just show a "?" where the question/answer would go.)
 */

async function fillTable() {
  let catagoryRow = $("
");
  $("thead").append(catagoryRow);

  for (let i = 0; i < NUM_CATEGORIES; i++) {
    $("Cat	").appendTo(catagoryRow);
  }

  for (let y = 0; y < NUM_QUESTIONS; y++) {
    let questionRow = $("
");
    $("tbody").append(questionRow);
    for (let x = 0; x < NUM_CATEGORIES; x++) {
      let question = $("").text("?").attr("id", `${x}-${y}`);
      question.appendTo(questionRow);
    }
  }
}

/** Handle clicking on a clue: show the question or answer.
 *
 * Uses .showing property on clue to determine what to show:
 * - if currently null, show question & set .showing to "question"
 * - if currently "question", show answer & set .showing to "answer"
 * - if currently "answer", ignore click
 * */

function handleClick(evt) {}

/** Wipe the current Jeopardy board, show the loading spinner,
 * and update the button used to fetch data.
 */

function showLoadingView() {
  $("table").show();
  $(".start").show();
}

/** Remove the loading spinner and update the button used to fetch data. */

function hideLoadingView() {
  $("header").hide();
  $("#spin-container").hide();
}

/** Start game:
 *
 * - get random category Ids
 * - get data for each category
 * - create HTML table
 * */

async function setupAndStart() {
  let categoryIDs = await getCategoryIds();
  categoryIDs.forEach(async (id) => {
    let tempCategory = await getCategory(id);
    categories.push(tempCategory);
  });
  fillTable();
  for (let i = 0; i < categories.length; i++) {
    console.log(categories);
  }
}

/** On click of start / restart button, set up game. */

// TODO

/** On page load, add event handler for clicking clues */

// TODO

setupAndStart();

```


问:
handling error message returned from server using jquery ajax
I have this code in backend written in flask:

username = signupInfo['username']
if Users.query.filter_by(username=username).first() is not None:
   return jsonify({"msg":"Username is already taken"}), 409
```
<p>I want to get the error message <code>{"msg:"Username is already taken"}</code>
using  Jquery ajax call to my server</p>
<p>Here is what I tried so far:</p>
<pre class="lang-js prettyprint-override"><code>const requestData = {
  firstName: "John",
  lastName: "Doe",
  username: "JohnDoe",
};
const url = "http://127.0.0.1:5000/api/v1/auth/signup";
$.ajax(url, {
  data: requestData,
  type: "POST",
  timeout: 5000,
})
  .done(function (data, textStatus, jqXHR) {
    alert(Object.keys(data));
  })
  .fail(function (jqXHR, textStatus, errorThrown) {
    response = {
      msg: "AJAX error response",
      errorThrown: errorThrown,
      url: url,
      requestData: requestData,
    };
    console.log(response);
  });
</code>```

Body:
I have this code in backend written in flask:

username = signupInfo['username']
if Users.query.filter_by(username=username).first() is not None:
   return jsonify({"msg":"Username is already taken"}), 409

I want to get the error message {"msg:"Username is already taken"}
using  Jquery ajax call to my server

Here is what I tried so far:

const requestData = {
  firstName: "John",
  lastName: "Doe",
  username: "JohnDoe",
};
const url = "http://127.0.0.1:5000/api/v1/auth/signup";
$.ajax(url, {
  data: requestData,
  type: "POST",
  timeout: 5000,
})
  .done(function (data, textStatus, jqXHR) {
    alert(Object.keys(data));
  })
  .fail(function (jqXHR, textStatus, errorThrown) {
    response = {
      msg: "AJAX error response",
      errorThrown: errorThrown,
      url: url,
      requestData: requestData,
    };
    console.log(response);
  });


问:
modelMapper's skip() method always return null
I cant set my id to null. because modelMapper's skip() method always return null. I don't know how to fix it. I trying to convert dto to entity.

I trying to convert dto to entity but

```<code>SubSectionGroupOptionsEntity skip = skip();
</code>```

always return null. I am using some configuration.

```<code>ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.LOOSE).setAmbiguityIgnored(true).setDeepCopyEnabled(true).setSkipNullEnabled(true);

modelMapper.addMappings(new PropertyMap<SubSectionGroupOptionsDTO, SubSectionGroupOptionsEntity>() {
    @Override
    protected void configure() {
        SubSectionGroupOptionsEntity skip = skip();
        skip.setId(null);
    }
});

QualitySectionMasterEntity qualitySectionMasterEntity = modelMapper.map(sectionSaveDTO, QualitySectionMasterEntity.class);
</code>```

Look here's my SubSectionGroupOptionsDTO class :

```<code>@AllArgsConstructor
@ToString
@Builder
@Data
@NoArgsConstructor
public class SubSectionGroupOptionsDTO {

    private Long id;

    private String optionName;

    private String inputType;

    private List<SubSectionGroupOptionActionsDTO> quesAnsGrpOptionAction;
}
</code>```

and my entity class is :

```<code>@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString
@Builder
@Entity
@Table(name = "sub_section_group_options")
public class SubSectionGroupOptionsEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "option_name")
    private String optionName;

    @Column(name = "input_type")
    private String inputType;

    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
    @JoinColumn(name = "sub_section_group_options_id")
    private List<SubSectionGroupOptionActions> subSectionGroupOptionActionsSet;
}
</code>```

Remember ::: SubSectionGroupOptionsEntity is a deep sub child of

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

please look and provide a fixed solution :

Body:
I cant set my id to null. because modelMapper's skip() method always return null. I don't know how to fix it. I trying to convert dto to entity.

I trying to convert dto to entity but

SubSectionGroupOptionsEntity skip = skip();

always return null. I am using some configuration.

ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.LOOSE).setAmbiguityIgnored(true).setDeepCopyEnabled(true).setSkipNullEnabled(true);

modelMapper.addMappings(new PropertyMap<SubSectionGroupOptionsDTO, SubSectionGroupOptionsEntity>() {
    @Override
    protected void configure() {
        SubSectionGroupOptionsEntity skip = skip();
        skip.setId(null);
    }
});

QualitySectionMasterEntity qualitySectionMasterEntity = modelMapper.map(sectionSaveDTO, QualitySectionMasterEntity.class);

Look here's my SubSectionGroupOptionsDTO class :

@AllArgsConstructor
@ToString
@Builder
@Data
@NoArgsConstructor
public class SubSectionGroupOptionsDTO {

    private Long id;

    private String optionName;

    private String inputType;

    private List<SubSectionGroupOptionActionsDTO> quesAnsGrpOptionAction;
}

and my entity class is :

@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString
@Builder
@Entity
@Table(name = "sub_section_group_options")
public class SubSectionGroupOptionsEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "option_name")
    private String optionName;

    @Column(name = "input_type")
    private String inputType;

    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
    @JoinColumn(name = "sub_section_group_options_id")
    private List<SubSectionGroupOptionActions> subSectionGroupOptionActionsSet;
}

Remember ::: SubSectionGroupOptionsEntity is a deep sub child of

QualitySectionMasterEntity

please look and provide a fixed solution :


问:
I just published a package on NPM, and installed it for testing, but can't import it
I just made a small JS package to help validate form controls, and I published it.

It is here on GitHub and NPM.

When I installed it, and imported it into a javascript file, for example:

import Validator from '@harukinguyen/validatorjs'
```

Then I got an error in the console:

Uncaught TypeError: Failed to resolve module specifier "@harukinguyen/validatorjs". Relative references must start with either "/", "./", or "../".

But when I tried to import it from ./node_modules/@harukinguyen/validatorjs/main.js (in case the main.js file and the node_modules is in the same directory), it worked correctly.

I also tried to add "type":"module" into the package.json file, but it doesn't work. I read about this solution on an GitHub issue.

Can anyone help me about this problem? I have no idea how to fix this! Thank you so much.

** By the way, can you explain the "type":"module" in the package.json file (I don't understand other questions on Google about what it is used for)? That's would be nice .

Body:
I just made a small JS package to help validate form controls, and I published it.

It is here on GitHub and NPM.

When I installed it, and imported it into a javascript file, for example:

import Validator from '@harukinguyen/validatorjs'

Then I got an error in the console:

Uncaught TypeError: Failed to resolve module specifier "@harukinguyen/validatorjs". Relative references must start with either "/", "./", or "../".

But when I tried to import it from ./node_modules/@harukinguyen/validatorjs/main.js (in case the main.js file and the node_modules is in the same directory), it worked correctly.

I also tried to add "type":"module" into the package.json file, but it doesn't work. I read about this solution on an GitHub issue.

Can anyone help me about this problem? I have no idea how to fix this! Thank you so much.

** By the way, can you explain the "type":"module" in the package.json file (I don't understand other questions on Google about what it is used for)? That's would be nice .


问:
Export interpolation results from R as GeoTIFF for import to OpenLayers
As a part of the research project on ecology, our team need to interpolate results of analysis of snow probes for pollutants. For that task we utilize Inverse distance weighting from R software.

For now, we use the following code for data reading and preparations:

```<code>library(sf)
library(stars)
library(tmap)
library(raster)
library(plotly)
library(mapview)
library(tidyverse)
library(ggrepel)
library(dismo)
library(akima)
library(gstat)
library(deldir)

options(scipen=999)

pts = read_table2("D:/www/baikal_so4.dat") %>% st_as_sf(coords = c('x', 'y'), crs = 4326, remove = FALSE)
pts = st_transform(pts, 3857)

coords = st_coordinates(pts)
box = st_bbox(pts)
envelope = box[c(1,3,2,4)]

px_grid = st_as_stars(box, dx = 500, dy = 500)

# Extracting points coordinates:
coords_grid = st_coordinates(px_grid)

#Initing color mapping
stat_colors = colorRampPalette(c('#7EBEDE', '#93C4D9','#A1C9D4','#B2D2CE', '#B9D4C6','#C3D9BB','#D2E3B9','#DDE8B0','#EEF2B1','#F9FBA5','#FDF798','#FDE791','#FBD992','#F9CB8A','#F8BF86','#F5B180','#F5A57C','#F39779','#F18272','#EF7474'))

stat_levels = seq(0, 3, by=0.2)
stat_ncolors = length(stat_levels)-1

stat_legend = scale_fill_manual(name = 'mg/l', values = stat_colors(stat_ncolors), guide = guide_legend(label.vjust = -0.3, reverse = TRUE, title.position = "bottom"), labels = stat_levels, na.value = 'white', drop = FALSE)

stat_mapping = aes(fill = cut(values, breaks = stat_levels))

#Delaune triangulation
edges = pts %>%
  st_union() %>%
  st_triangulate()
</code>```

Code for interpolation

```<code>px_grid = px_grid %>%
  mutate(z_idw2 = gstat::idw(values ~ 1, locations = pts, newdata = px_grid, idp = 2.0) %>% pull(var1.pred) %>% as('vector'),
         z_idw3 = gstat::idw(values ~ 1, locations = pts, newdata = px_grid, idp = 3.0) %>% pull(var1.pred) %>% as('vector'),
         z_idw4 = gstat::idw(values ~ 1, locations = pts, newdata = px_grid, idp = 4.0) %>% pull(var1.pred) %>% as('vector'),
         z_idw5 = gstat::idw(values ~ 1, locations = pts, newdata = px_grid, idp = 5.0) %>% pull(var1.pred) %>% as('vector'))

cont_idw2 = st_contour(px_grid['z_idw2'],
                       breaks = stat_levels,
                       contour_lines = TRUE)

cont_idw3 = st_contour(px_grid['z_idw3'],
                       breaks = stat_levels,
                       contour_lines = TRUE)

cont_idw4 = st_contour(px_grid['z_idw4'],
                       breaks = stat_levels,
                       contour_lines = TRUE)

cont_idw5 = st_contour(px_grid['z_idw5'],
                       breaks = stat_levels,
                       contour_lines = TRUE)

ggplot() +
  geom_stars(data = cut(px_grid['z_idw5'], breaks = stat_levels)) +
  stat_legend +
  coord_sf(crs = st_crs(pts)) +
  geom_sf(data = cont_idw5, color = 'black', size = 0.2) +
  geom_sf(data = pts, color = 'red', size = 0.5) +
  geom_sf(data = edges, color = 'red', size = 0.1, fill = NA)
</code>```

Which give us this result

In this question I don't consider the correctness of the result. The problem is that we need  to export this result to our Web application that uses OpenLayers library. When I try to export for example, px_grid['z_idw5'] to GeoTiff using write_stars method, I get the following result which looks, well, close to the first one, but without colors.

So, my question is: how can I export the results of the interpolation to GeoTIFF with predefined colors?

Body:
As a part of the research project on ecology, our team need to interpolate results of analysis of snow probes for pollutants. For that task we utilize Inverse distance weighting from R software.

For now, we use the following code for data reading and preparations:

library(sf)
library(stars)
library(tmap)
library(raster)
library(plotly)
library(mapview)
library(tidyverse)
library(ggrepel)
library(dismo)
library(akima)
library(gstat)
library(deldir)

options(scipen=999)

pts = read_table2("D:/www/baikal_so4.dat") %>% st_as_sf(coords = c('x', 'y'), crs = 4326, remove = FALSE)
pts = st_transform(pts, 3857)

coords = st_coordinates(pts)
box = st_bbox(pts)
envelope = box[c(1,3,2,4)]

px_grid = st_as_stars(box, dx = 500, dy = 500)

# Extracting points coordinates:
coords_grid = st_coordinates(px_grid)

#Initing color mapping
stat_colors = colorRampPalette(c('#7EBEDE', '#93C4D9','#A1C9D4','#B2D2CE', '#B9D4C6','#C3D9BB','#D2E3B9','#DDE8B0','#EEF2B1','#F9FBA5','#FDF798','#FDE791','#FBD992','#F9CB8A','#F8BF86','#F5B180','#F5A57C','#F39779','#F18272','#EF7474'))

stat_levels = seq(0, 3, by=0.2)
stat_ncolors = length(stat_levels)-1

stat_legend = scale_fill_manual(name = 'mg/l', values = stat_colors(stat_ncolors), guide = guide_legend(label.vjust = -0.3, reverse = TRUE, title.position = "bottom"), labels = stat_levels, na.value = 'white', drop = FALSE)

stat_mapping = aes(fill = cut(values, breaks = stat_levels))

#Delaune triangulation
edges = pts %>%
  st_union() %>%
  st_triangulate()

Code for interpolation

px_grid = px_grid %>%
  mutate(z_idw2 = gstat::idw(values ~ 1, locations = pts, newdata = px_grid, idp = 2.0) %>% pull(var1.pred) %>% as('vector'),
         z_idw3 = gstat::idw(values ~ 1, locations = pts, newdata = px_grid, idp = 3.0) %>% pull(var1.pred) %>% as('vector'),
         z_idw4 = gstat::idw(values ~ 1, locations = pts, newdata = px_grid, idp = 4.0) %>% pull(var1.pred) %>% as('vector'),
         z_idw5 = gstat::idw(values ~ 1, locations = pts, newdata = px_grid, idp = 5.0) %>% pull(var1.pred) %>% as('vector'))

cont_idw2 = st_contour(px_grid['z_idw2'],
                       breaks = stat_levels,
                       contour_lines = TRUE)

cont_idw3 = st_contour(px_grid['z_idw3'],
                       breaks = stat_levels,
                       contour_lines = TRUE)

cont_idw4 = st_contour(px_grid['z_idw4'],
                       breaks = stat_levels,
                       contour_lines = TRUE)

cont_idw5 = st_contour(px_grid['z_idw5'],
                       breaks = stat_levels,
                       contour_lines = TRUE)

ggplot() +
  geom_stars(data = cut(px_grid['z_idw5'], breaks = stat_levels)) +
  stat_legend +
  coord_sf(crs = st_crs(pts)) +
  geom_sf(data = cont_idw5, color = 'black', size = 0.2) +
  geom_sf(data = pts, color = 'red', size = 0.5) +
  geom_sf(data = edges, color = 'red', size = 0.1, fill = NA)

Which give us this result

In this question I don't consider the correctness of the result. The problem is that we need  to export this result to our Web application that uses OpenLayers library. When I try to export for example, px_grid['z_idw5'] to GeoTiff using write_stars method, I get the following result which looks, well, close to the first one, but without colors.

So, my question is: how can I export the results of the interpolation to GeoTIFF with predefined colors?


问:
Can we create a programmable search using the google custom search for a private URL which is deployed in app engine and if so, how?
Is it possible to create a programmable search using the google custom search for a private URL which is deployed in app engine ?

Tried many ways but didn't work got no results when searching the specific site.


问:
Triple dependent dropdown in appsheet from google sheet with formula
How can i create triple dependent dropdown in appsheet from google sheet with formula step by step procedure.

I am beginner in this, i just created a triple dependant drop down by watching youtube but the 3rd drop down are not dependant 1st coulmn. hence required a solution.


问:
Run Webpack plug-in for generating type definitions only once when watch mode is enabled
I use the bundle-declarations-webpack-plugin to generate a single .d.ts file for my entire project. This plugin works well, but slows down every incremental Webpack run dramatically when watch mode is enabled.

For example, without the plugin, Webpack only needs a few milliseconds for incremental runs. With the plugin, however, Webpack needs more than 10 seconds for incremental runs, even my project contains only a few dozens of files.

Is there any way to tell Webpack to run the bundle-declarations-webpack-plugin only on the first full startup run, but not on the incremental runs? I need the generated .d.ts file on startup. However, I can a accept if the type definitions are not updated on incremental runs in order to benefit from a better performance.


问:
Executing background task in python and return API response quickly
API description

I am creating a REST API in Flask

POST API call creates a new entry in DB and returns the primary key of that entry to the

Long running task inside the API

Running a shell command that makes a network call which lasts about 6/7 seconds

Based on the output of the shell command, updating the DB

Main issue with above

We cannot have our API take such long time to return

Since our return value is NOT dependent on step 2,3 - we can execute them in background

We can return immediately after creating an entry in DB and asking remainder to be done in background

How should we do this? (I can think of 4 ways)

Process pool (am ok with scaling limitation)

Task queue & workers (too much infra manage, setup)

Thread pool (possible GIL, though not much)

AsyncIO/gevent (might not allow API to return quickly)


问:
Outbox pattern and Inbox pattern is not guaranteed your delivery as well. How can i be safe for the message broker?
There is an event and I want to make sure it delivered.

You know, in the outbox pattern, we save the event to the db before sending it to the message broker and delete it after publishing.

However, if I apply it in inbox pattern, we first read the message from the broker on the consumer side and delete it after the transaction.

But my problem is, there are 100 pending events on the message broker right now, and just in the meantime, the message broker crashed and the events disappeared. These events are not in my Outbox table because I deleted them when it was published. It is not in my inbox table because the consumer has not read it yet.

How can I solve this situation?


问:
wafv2 firewall rules to restrict domain names
I created WAFV2 firewall rules to restrict few IP address to hit API gateways. it is working as expected.

```<code># ipsets
resource "aws_wafv2_ip_set" "example-ip-sets" {
  name               = "ipsetsexample"
  description        = "Example IP set"
  scope              = "REGIONAL"
  ip_address_version = "IPV4"
  addresses          = ["137.137.43.154/32", "40.121.120.150/32"]

  tags = {
    Tag1 = "Value1"
    Tag2 = "Value2"
  }
}

resource "aws_wafv2_web_acl" "firewall" {
  name = "firewall"
  scope = "REGIONAL"
  default_action {
    block {}
  }
  rule {
    name     = "ip-blacklist"
    priority = 1
    action {
      allow {}
    }
    statement {
      ip_set_reference_statement {
        arn = aws_wafv2_ip_set.example-ip-sets.arn
      }
    }

    visibility_config {
      cloudwatch_metrics_enabled = true
      metric_name                = "BlacklistedIP"
      sampled_requests_enabled   = true
    }
  }

  visibility_config {
    cloudwatch_metrics_enabled = true
    metric_name                = "Allowed"
    sampled_requests_enabled   = true
  }
}

resource "aws_wafv2_web_acl_association" "this" {
  resource_arn = aws_api_gateway_stage.api_stage.arn
  web_acl_arn  = aws_wafv2_web_acl.firewall.arn
}

</code>```

but now new scenario came in to picture like, block some domain names instead of IP's (abcde.com, us1a.bcde.com) to invoke the API gateways. I have searched many terraform docs but didn't find any related.
is there any docs or source to restrict domain names to hit the API gateway ?

Body:
I created WAFV2 firewall rules to restrict few IP address to hit API gateways. it is working as expected.

# ipsets
resource "aws_wafv2_ip_set" "example-ip-sets" {
  name               = "ipsetsexample"
  description        = "Example IP set"
  scope              = "REGIONAL"
  ip_address_version = "IPV4"
  addresses          = ["137.137.43.154/32", "40.121.120.150/32"]

  tags = {
    Tag1 = "Value1"
    Tag2 = "Value2"
  }
}

resource "aws_wafv2_web_acl" "firewall" {
  name = "firewall"
  scope = "REGIONAL"
  default_action {
    block {}
  }
  rule {
    name     = "ip-blacklist"
    priority = 1
    action {
      allow {}
    }
    statement {
      ip_set_reference_statement {
        arn = aws_wafv2_ip_set.example-ip-sets.arn
      }
    }

    visibility_config {
      cloudwatch_metrics_enabled = true
      metric_name                = "BlacklistedIP"
      sampled_requests_enabled   = true
    }
  }

  visibility_config {
    cloudwatch_metrics_enabled = true
    metric_name                = "Allowed"
    sampled_requests_enabled   = true
  }
}

resource "aws_wafv2_web_acl_association" "this" {
  resource_arn = aws_api_gateway_stage.api_stage.arn
  web_acl_arn  = aws_wafv2_web_acl.firewall.arn
}

but now new scenario came in to picture like, block some domain names instead of IP's (abcde.com, us1a.bcde.com) to invoke the API gateways. I have searched many terraform docs but didn't find any related.
is there any docs or source to restrict domain names to hit the API gateway ?


问:
Laravel Console Testing Issue On Confirmation's Exit Code
When I run my command, I want to ask for a confirmation to proceed unless APP_ENV is testing. Command side is easy, but I couldn't make its test work.

// MyConsoleCommand.php

public function handle()
{
    if ($this->isTerminated()) return;
}

public function isTerminated()
{
    return env('APP_ENV') != 'testing'
        ? !$this->confirm("my confirmation message")
        : false;
}

```
<pre class="lang-php prettyprint-override"><code>// MyConsoleCommandTest.php

public function test_run()
{
    $_ENV['APP_ENV'] = 'something';
    config()->set('app.env', 'something');

    $this->artisan('mycommand')
        ->expectsConfirmation("my confirmation message", false)
        ->assertExitCode(0);

    $this->artisan('mycommand')
        ->expectsConfirmation("my confirmation message", true)
        ->assertExitCode(1);
}
</code>```

The test with assertExitCode(1) always fails regardless of the answer of the confirmation. How can I amke it work correctly?

Thanks in advance.

Body:
When I run my command, I want to ask for a confirmation to proceed unless APP_ENV is testing. Command side is easy, but I couldn't make its test work.

// MyConsoleCommand.php

public function handle()
{
    if ($this->isTerminated()) return;
}

public function isTerminated()
{
    return env('APP_ENV') != 'testing'
        ? !$this->confirm("my confirmation message")
        : false;
}

// MyConsoleCommandTest.php

public function test_run()
{
    $_ENV['APP_ENV'] = 'something';
    config()->set('app.env', 'something');

    $this->artisan('mycommand')
        ->expectsConfirmation("my confirmation message", false)
        ->assertExitCode(0);

    $this->artisan('mycommand')
        ->expectsConfirmation("my confirmation message", true)
        ->assertExitCode(1);
}

The test with assertExitCode(1) always fails regardless of the answer of the confirmation. How can I amke it work correctly?

Thanks in advance.


问:
Plotting multiple classifier ROC curvers in one plot in JMP Pro
I have 4 sets of numeric continuous data that I used for regression analysis.

Now, I performed ROC analysis using "Fit Y by X" option of "JMP Pro" for each set of data which generated me 4 seperate AUC curves and graphs of ROC in the "JMP Pro" program.

I obtained these curves using the following steps:

My question is, how can I generate all of these graphs in one plot?

What I mean, when I did generated plots, it became like the two in the above of this attached picture. I want something like in the bottom of this picture

For example, the steps required in the software?


问:
Skip the cursor from screen reader only p tag when contentEditable is true
I have a scenario, to activate the keyboard highlighting I need to add the contentEditable = true on enter press when focus is on main tag. Problem is that the tab press on focus comes on the main tag and I press the enter editing on content gets activated but the cursor is not visible on the first text of paragraph. This is because I have a hidden p tag in my html which consumes the cursor on enter press.

```<code></code>```
```<code><p class="screen-reader-only">Page 4 and 5</p>
<style>
.screen-reader-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
</style>

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

Really stuck, Anybody please help?

Body:
I have a scenario, to activate the keyboard highlighting I need to add the contentEditable = true on enter press when focus is on main tag. Problem is that the tab press on focus comes on the main tag and I press the enter editing on content gets activated but the cursor is not visible on the first text of paragraph. This is because I have a hidden p tag in my html which consumes the cursor on enter press.

Page 4 and 5

Really stuck, Anybody please help?


问:
Can I use xaml binging without ui? without derive from control?
I want to use xaml to build my workflow like this to split the workflow design and functions.

```<code><Command x:Class="MyCommand">
  <Step1 Name="">
     <Step2 />
  </Step1>
</Command/>
</code>```

it works.
but when I want to get a value may be updated, i must write a event:

```<code><Command x:Class="MyCommand">
  <Step1  GetName="OnGetName">
     <Step2 />
  </Step1>
</Command/>
void OnGetName(out string name){name = "xxx";}
</code>```

I think wpf's binding is very well for me ,but sine there are no window, my classes are not inherit from control, It cannot work, event I make my classes inherit from DependencyObject.

Is there any way to import a binding like method?

I update my question as maybe a complete new question.
My real request is use xaml binding without window.

at beginning, I don't want to inherit from Control or FrameworkElement. bug I find it is impossible.

now I update my code to inherit from FrameworkElement, it can work by write binding, but event not with xaml.

```<code>public class Command : FrameworkElement
{
       public static readonly DependencyProperty Test1Property = DependencyProperty.Register(
            nameof(Test1), typeof(string), typeof(UserControl1), new PropertyMetadata(default(string)));

        public string Test1
        {
            get { return (string)GetValue(Test1Property); }
            set { SetValue(Test1Property, value); }
        }

        public static readonly DependencyProperty Test2Property = DependencyProperty.Register(
            nameof(Test2), typeof(string), typeof(UserControl1), new PropertyMetadata(default(string)));

        public string Test2
        {
            get { return (string)GetValue(Test2Property); }
            set { SetValue(Test2Property, value); }
        }
}
</code>```

I add a window:

```<code><Window x:Class="WpfApp2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp2"
        mc:Ignorable="d" x:Name="Main"
        DataContext="{x:Reference Main}"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <local:UserControl1 x:Name="Control" Test1="{Binding TestStr, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"></local:UserControl1>
    </Grid>
</Window>
</code>```

and init the Test2 binding by code:

```<code>        public MainWindow()
        {
            InitializeComponent();
            var binding = new Binding("TestStr")
            {
                Source = this,
            };
            BindingOperations.SetBinding(Control, UserControl1.Test2Property, binding);

            TestStr = "XXS";

            MessageBox.Show($"ONLoad: Test1: {Control.Test1}, Test2: {Control.Test2}");
}

</code>```

then if I new the MainWindow, without Show(), I get the MessageBox show

```<code>Test1:, Test2:XXS
</code>```

I want to find a way to make the xaml binding work before show()!

Body:
I want to use xaml to build my workflow like this to split the workflow design and functions.

<Command x:Class="MyCommand">
  <Step1 Name="">
     <Step2 />
  </Step1>
</Command/>

it works.
but when I want to get a value may be updated, i must write a event:

<Command x:Class="MyCommand">
  <Step1  GetName="OnGetName">
     <Step2 />
  </Step1>
</Command/>
void OnGetName(out string name){name = "xxx";}

I think wpf's binding is very well for me ,but sine there are no window, my classes are not inherit from control, It cannot work, event I make my classes inherit from DependencyObject.

Is there any way to import a binding like method?

I update my question as maybe a complete new question.
My real request is use xaml binding without window.

at beginning, I don't want to inherit from Control or FrameworkElement. bug I find it is impossible.

now I update my code to inherit from FrameworkElement, it can work by write binding, but event not with xaml.

public class Command : FrameworkElement
{
       public static readonly DependencyProperty Test1Property = DependencyProperty.Register(
            nameof(Test1), typeof(string), typeof(UserControl1), new PropertyMetadata(default(string)));

        public string Test1
        {
            get { return (string)GetValue(Test1Property); }
            set { SetValue(Test1Property, value); }
        }

        public static readonly DependencyProperty Test2Property = DependencyProperty.Register(
            nameof(Test2), typeof(string), typeof(UserControl1), new PropertyMetadata(default(string)));

        public string Test2
        {
            get { return (string)GetValue(Test2Property); }
            set { SetValue(Test2Property, value); }
        }
}

I add a window:

<Window x:Class="WpfApp2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp2"
        mc:Ignorable="d" x:Name="Main"
        DataContext="{x:Reference Main}"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <local:UserControl1 x:Name="Control" Test1="{Binding TestStr, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"></local:UserControl1>
    </Grid>
</Window>

and init the Test2 binding by code:

        public MainWindow()
        {
            InitializeComponent();
            var binding = new Binding("TestStr")
            {
                Source = this,
            };
            BindingOperations.SetBinding(Control, UserControl1.Test2Property, binding);

            TestStr = "XXS";

            MessageBox.Show($"ONLoad: Test1: {Control.Test1}, Test2: {Control.Test2}");
}

then if I new the MainWindow, without Show(), I get the MessageBox show

Test1:, Test2:XXS

I want to find a way to make the xaml binding work before show()!


问:
Run click event on multiple buttons according to their IDs in one function using JS only and not Jquery
I have buttons in div and they all have IDs. How can I make a single function in Javascript so that it performs same function for all buttons according to what button ID is clicked? I tried querySelectorAll in JS but nothing's working. Can anyone suggest an example through code?</p>


问:
How to add a mysql function inside the values array while running an sql query in node js
I want to insert data into a table and I am running the query in node.js app.
So I've created an array of values so that data could be inserted in a single query.
One column in my table is log date and it accepts data which is given by

```<code>UNIX_TIMESTAMP()*1000
</code>```

function.

I dont want to change table schema but instead want to send this in query. Also I dont want to use for loop to run separate query to enter each row.

I added this function in values array but node.js doesn't know it and if I add this function as string then the query gives error.

```<code>let values = [
[5000, 1],
[6000, 2],
[8000, 3]
];

let query = `insert into price_table (price, id,log_date) values ?;`;
await db.query(query, [values]);
</code>```

how do I put value for log_date as UNIX_TIMESTAMP()*1000

Body:
I want to insert data into a table and I am running the query in node.js app.
So I've created an array of values so that data could be inserted in a single query.
One column in my table is log date and it accepts data which is given by

UNIX_TIMESTAMP()*1000

function.

I dont want to change table schema but instead want to send this in query. Also I dont want to use for loop to run separate query to enter each row.

I added this function in values array but node.js doesn't know it and if I add this function as string then the query gives error.

let values = [
[5000, 1],
[6000, 2],
[8000, 3]
];

let query = `insert into price_table (price, id,log_date) values ?;`;
await db.query(query, [values]);

how do I put value for log_date as UNIX_TIMESTAMP()*1000


问:
Sequelize findOne not working as expected
I need to return data by id from a Postgres database. When trying to do this, it throws an error:

```<code>Support for `{where: 'raw query'}` has been removed.
</code>```

What is the problem, why is that?

```<code>async getBookData(req, res) {
    try {
        const {id} = req.params;
        console.log(id);
        const book = await Book.findOne({
            where: id
        });
        if(!book) {
            return res.status(400).json({message: 'Book does not exist'});
        }
        console.log(book);
        return res.json(book);
    } catch (e) {
        console.log(e.message);
        return res.status(400).json({message: 'Book data retrieval error'});
    }
}
</code>```

Body:
I need to return data by id from a Postgres database. When trying to do this, it throws an error:

Support for `{where: 'raw query'}` has been removed.

What is the problem, why is that?

async getBookData(req, res) {
    try {
        const {id} = req.params;
        console.log(id);
        const book = await Book.findOne({
            where: id
        });
        if(!book) {
            return res.status(400).json({message: 'Book does not exist'});
        }
        console.log(book);
        return res.json(book);
    } catch (e) {
        console.log(e.message);
        return res.status(400).json({message: 'Book data retrieval error'});
    }
}


问:
Application crashes using Py_DECREF on string PyObject in .dll built with Python C API
I am building a DLL to embed Python 2.7 (2.7.18 to be specific) in a larger application largely following python.org's C API documentation. When I believe I am applying Py_DECREF correctly to a PyString PyObject, any linking application crashes without error. The code is largely copied from a similar application built with python 3.8, 3.9 and 3.10 that in fact works.

```<code>// python_functions.h
__declspec(dllexport) int init_python();

</code>```
```<code>// python_functions.c
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stdio.h> // printf
#include <string.h>
//#include <wchar.h> // wchar_t for python3 only
#include "python_functions.h"

__declspec(dllexport) int init_python() {
    int rv = -1;
    printf("attempting to initialize Python interpreter...\n");

    // I have other python versions, Python27 not on path. set PYTHONHOME
    Py_SetPythonHome("C:\\Python27\\"); // python27
    //Py_SetPythonHome(L"C:\\Python38\\"); // python3X

    Py_Initialize();

    PyObject * pModule_Name = PyString_FromString("python_functions"); // python27 only
    //PyObject * pModule_Name = PyUnicode_FromString("python_functions"); // python3X
    if (!pModule_Name) {
        printf("failed to convert module name to python string object\n");
        return rv;
    }

    // can confirm pModule_Name != NULL && Py_REFCNT(pModule_Name) == 1 here

    /*
    load python module named "python_functions"
    */

    // can also confirm pModule_Name != NULL && Py_REFCNT(pModule_Name) == 1 here

    //Py_DECREF(pModule_Name); // If I uncomment this line, application linking .dll crashes

    printf("pModule_Name successfully used\n");
    rv = 0;
    return rv;

}
</code>```
```<code>// main.c
#include <stdio.h>
#include "python_functions.h"

int main(int argc, char **argv) {
    int rv = 0;

    // crashes without error if Py_DECREF(pModule_Name) in python_functions.c uncommented
    printf("%d\n", init_python());

    return rv;
}
</code>```

Compiling the .dll with gcc 8.1.0 (MinGW-64) linking against C:\Python27\python27.dll:
gcc -IC:\Python27\include -LC:\Python27\libs -IC:\Python27 python_functions.c -shared -o python_functions.dll -lpython27

Compiling main with python27.dll and python_functions.dll in the same directory:
gcc main.c -o main.exe -L./ -lpython_functions

If I uncomment the line Py_DECREF(pModule_Name), which I thought I must do since PyString_FromString returns a new reference, then running main.exe crashes without return.

Should I be using something else or not doing reference counting on result from PyString_FromString or is this a larger problem with linking to python27?

If I make the commented/corresponding compiler changes to link against python 3.8+, no problems...

The only differences I know of are the significant changes to the Python C API between 2.7 and e.g. 3.8+ as well as the differences in python 2.X vs 3.X string representations. I believe PyString is appropriate here because when I actually implement and load a module name python_functions.py, it works...so long as I leave Py_DECREF(pModule_Name) commented out and the pointer leaked.

I also thought PyString_FromString might have a problem passing a string literal, but it accepts a const char *, documentation says it creates a copy, and even passing a copy of the string literal to another variable does not work.

Body:
I am building a DLL to embed Python 2.7 (2.7.18 to be specific) in a larger application largely following python.org's C API documentation. When I believe I am applying Py_DECREF correctly to a PyString PyObject, any linking application crashes without error. The code is largely copied from a similar application built with python 3.8, 3.9 and 3.10 that in fact works.

// python_functions.h
__declspec(dllexport) int init_python();

// python_functions.c
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stdio.h> // printf
#include <string.h>
//#include <wchar.h> // wchar_t for python3 only
#include "python_functions.h"

__declspec(dllexport) int init_python() {
    int rv = -1;
    printf("attempting to initialize Python interpreter...\n");

    // I have other python versions, Python27 not on path. set PYTHONHOME
    Py_SetPythonHome("C:\\Python27\\"); // python27
    //Py_SetPythonHome(L"C:\\Python38\\"); // python3X

    Py_Initialize();

    PyObject * pModule_Name = PyString_FromString("python_functions"); // python27 only
    //PyObject * pModule_Name = PyUnicode_FromString("python_functions"); // python3X
    if (!pModule_Name) {
        printf("failed to convert module name to python string object\n");
        return rv;
    }

    // can confirm pModule_Name != NULL && Py_REFCNT(pModule_Name) == 1 here

    /*
    load python module named "python_functions"
    */

    // can also confirm pModule_Name != NULL && Py_REFCNT(pModule_Name) == 1 here

    //Py_DECREF(pModule_Name); // If I uncomment this line, application linking .dll crashes

    printf("pModule_Name successfully used\n");
    rv = 0;
    return rv;

}

// main.c
#include <stdio.h>
#include "python_functions.h"

int main(int argc, char **argv) {
    int rv = 0;

    // crashes without error if Py_DECREF(pModule_Name) in python_functions.c uncommented
    printf("%d\n", init_python());

    return rv;
}

Compiling the .dll with gcc 8.1.0 (MinGW-64) linking against C:\Python27\python27.dll:
gcc -IC:\Python27\include -LC:\Python27\libs -IC:\Python27 python_functions.c -shared -o python_functions.dll -lpython27

Compiling main with python27.dll and python_functions.dll in the same directory:
gcc main.c -o main.exe -L./ -lpython_functions

If I uncomment the line Py_DECREF(pModule_Name), which I thought I must do since PyString_FromString returns a new reference, then running main.exe crashes without return.

Should I be using something else or not doing reference counting on result from PyString_FromString or is this a larger problem with linking to python27?

If I make the commented/corresponding compiler changes to link against python 3.8+, no problems...

The only differences I know of are the significant changes to the Python C API between 2.7 and e.g. 3.8+ as well as the differences in python 2.X vs 3.X string representations. I believe PyString is appropriate here because when I actually implement and load a module name python_functions.py, it works...so long as I leave Py_DECREF(pModule_Name) commented out and the pointer leaked.

I also thought PyString_FromString might have a problem passing a string literal, but it accepts a const char *, documentation says it creates a copy, and even passing a copy of the string literal to another variable does not work.


问:
Flutter3 AndroidView is not able to be tapped
I am using AndroidView. But I can not tap the button in android native view.
In Flutter2 I can it easily. I use Flutter 3.3.6.
How can I tap the button in android native view?

Thank you.

```<code>AndroidView(
  viewType: "myAndroidView",
  onPlatformViewCreated: (id) {
    print("onPlatformViewCreated@myAndroidView:${id}");
  },
  gestureRecognizers: <
      Factory<OneSequenceGestureRecognizer>>{
    Factory<OneSequenceGestureRecognizer>(
      () => EagerGestureRecognizer(),
    ),
  },
  hitTestBehavior: PlatformViewHitTestBehavior.opaque,
)

</code>```

Body:
I am using AndroidView. But I can not tap the button in android native view.
In Flutter2 I can it easily. I use Flutter 3.3.6.
How can I tap the button in android native view?

Thank you.

AndroidView(
  viewType: "myAndroidView",
  onPlatformViewCreated: (id) {
    print("onPlatformViewCreated@myAndroidView:${id}");
  },
  gestureRecognizers: <
      Factory<OneSequenceGestureRecognizer>>{
    Factory<OneSequenceGestureRecognizer>(
      () => EagerGestureRecognizer(),
    ),
  },
  hitTestBehavior: PlatformViewHitTestBehavior.opaque,
)


问:
How to decide which matching score is best or worst in Elasticsearch
I am currently running search based based name, address, city, state and zip code on Elasticsearch index. I am getting some best matches and some worst also.

Name, address, city , state and zip code is different column and same way indexed into Elasticsearch, I have added index mapping.

Requirement: I have to decide a baseline score, which will be used to accept or decline matching results.

```<code>{
    "properties": {
        "id": {
            "type": "integer"
        },
        "name": {
            "type": "text"
        },
        "address": {
            "type": "text"
        },
        "city": {
            "type": "keyword",
            "normalizer": "lowercase"
        },
        "state": {
            "type": "keyword",
            "normalizer": "lowercase"
        },
        "zip_code": {
            "type": "keyword",
            "normalizer": "lowercase"
        }
   }
}
</code>```

Any help here is really appreciated.

Thanks

Body:
I am currently running search based based name, address, city, state and zip code on Elasticsearch index. I am getting some best matches and some worst also.

Name, address, city , state and zip code is different column and same way indexed into Elasticsearch, I have added index mapping.

Requirement: I have to decide a baseline score, which will be used to accept or decline matching results.

{
    "properties": {
        "id": {
            "type": "integer"
        },
        "name": {
            "type": "text"
        },
        "address": {
            "type": "text"
        },
        "city": {
            "type": "keyword",
            "normalizer": "lowercase"
        },
        "state": {
            "type": "keyword",
            "normalizer": "lowercase"
        },
        "zip_code": {
            "type": "keyword",
            "normalizer": "lowercase"
        }
   }
}

Any help here is really appreciated.

Thanks


问:
In Postgres database How to get column values in one single row comma separated value
I am doing it in nodejs please guide me to get expected output in postgres

my table creation Query

```<code>CREATE TABLE IF NOT EXISTS "detailed_data" (
        "id" SERIAL,
        "data" VARCHAR(100) NOT NULL,
            "bike_used" int default 0,
        PRIMARY KEY ("data")
    );
</code>```

Queries for data insertion

1.Query for bikes if it used at least once to update bike count to know how many time it used

```<code>(`UPDATE "detailed_data"  SET bike_used=bike_used+1 WHERE "data" = $1`,[data])
</code>```

2.if bike is going to used first time

```<code>(`INSERT INTO "detailed_data" ("data") VALUES ($1) ON CONFLICT ("data") DO NOTHING`,[.data])
</code>```

I have table like

ID  | data   | bike_used
1   |bike1   |  4
2   |bike2   |  5
3   |bike3   |  1
```
<p>I want to get datatable ouput like</p>
<pre class="lang-none prettyprint-override"><code>ID  | data   | bike_used  |    used_by
1   |bike1   |  4         |    rohan,roy,jim,rocky
</code>```

Body:
I am doing it in nodejs please guide me to get expected output in postgres

my table creation Query

CREATE TABLE IF NOT EXISTS "detailed_data" (
        "id" SERIAL,
        "data" VARCHAR(100) NOT NULL,
            "bike_used" int default 0,
        PRIMARY KEY ("data")
    );

Queries for data insertion

1.Query for bikes if it used at least once to update bike count to know how many time it used

(`UPDATE "detailed_data"  SET bike_used=bike_used+1 WHERE "data" = $1`,[data])

2.if bike is going to used first time

(`INSERT INTO "detailed_data" ("data") VALUES ($1) ON CONFLICT ("data") DO NOTHING`,[.data])

I have table like

ID  | data   | bike_used
1   |bike1   |  4
2   |bike2   |  5
3   |bike3   |  1

I want to get datatable ouput like

ID  | data   | bike_used  |    used_by
1   |bike1   |  4         |    rohan,roy,jim,rocky


问:
Access current row data in Vuestic UI Data Table from template
due to lack of migration to Vue3 from Vuetify, I turned to Vuestic UI, which seems to do the job as intented, without to much of a pain to switch.

I have to display data, in a Data Table component, coming from an external API. Got it all working.
I'm using slots to control displayed data, but I'm missing a functionality which was implemented in Vuetify.

I have to access the current row's data in a cell to format an email address, but I can't get it to work.

Basically, i would like to get something as this code portion in Vuetify:

```<code><v-data-table >
   <template v-slot:item.colName="{ item }">
     // Do something with the current item data
   </template>
</v-data-table>
</code>```

I came up with this code from the official documentation

```<code><va-data-table>
    <template #cell(email.0.value)="{ value }">
        <a :href="`mailto:${value}?subject=${getRowDataHere}`">
            {{ value }}
        </a>
    </template>
</va-data-table>
</code>```

I don't know if I a missing something here, but I've been searching around since yersterday without any positive results.

EDIT: After diving in the Vuestic github Repo, and going through the main code, here is the solution for some in need :

```<code><template #cell(colKey)="{ rowData }">
   {{ rowData.property }}
</template>
</code>```

Body:
due to lack of migration to Vue3 from Vuetify, I turned to Vuestic UI, which seems to do the job as intented, without to much of a pain to switch.

I have to display data, in a Data Table component, coming from an external API. Got it all working.
I'm using slots to control displayed data, but I'm missing a functionality which was implemented in Vuetify.

I have to access the current row's data in a cell to format an email address, but I can't get it to work.

Basically, i would like to get something as this code portion in Vuetify:

<v-data-table >
   <template v-slot:item.colName="{ item }">
     // Do something with the current item data
   </template>
</v-data-table>

I came up with this code from the official documentation

<va-data-table>
    <template #cell(email.0.value)="{ value }">
        <a :href="`mailto:${value}?subject=${getRowDataHere}`">
            {{ value }}

    </template>
</va-data-table>

I don't know if I a missing something here, but I've been searching around since yersterday without any positive results.

EDIT: After diving in the Vuestic github Repo, and going through the main code, here is the solution for some in need :

<template #cell(colKey)="{ rowData }">
   {{ rowData.property }}
</template>


问:
Not able to correctly filter data using cascading multi select dropdown Syncfusion
I am using multi select dropdown with dependent dropdowns like below

Populating these list via api. Now if i select one value i am calling (change) function of angular to get the id of the dropdown and then calling a function to change other dropdown values.

OnChangeair(e){
  if(e.element.id=='airid')
  this.filterAirId(this.airIDModel)
  else if(e.element.id=='airlead')
  this.filterLead(this.airLeadModel)
  else if(e.element.id=='airmd')
  this.filterManagingDirector(this.airManagingDirectorModel)
  else if(e.element.id=='airmanager')
  this.filterManager(this.airManagerModel)
  else if(e.element.id=='airaim')
  this.filterAIM(this.airAIMProjectNameModel)
  else if(e.element.id=='airse')
  this.filterServiceArea(this.airServiceAreaModel)
}```
</div>
</div>
</p>
<p>Function to change the list is</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>filterAirId(airid){
  if(airid.length == 0){
    this.getAIRData();
  }
  else{
    let finalArr = [];
    airid.forEach((item)=>{
      var name = this.airData.filter( el=>el.AIRID == item );
      this.airData.push.apply(finalArr,name);
  });
  this.airManagingDirectorData=finalArr;
  this.airServiceAreaData = finalArr;
  this.airLeadData = finalArr;
  this.airManagerData = finalArr;
  this.airAIMProjectNameData = finalArr;
  console.log(finalArr);
  }
  //this.assetData = this.assetData.filter((item) => item.AIRID == airid);
}</code>```

Now this works when i select any one of them others get correctly populated. But when i select another field the previous one's field gets replaced and my change event gets fired continuously resulting in

Angular HTML

<ejs-multiselect id='airid'  (change)="OnChangeair($event)"  [(value)]="airIDModel" [dataSource]='airIDData' [fields]='airIdFields' [allowFiltering]='true' [placeholder]='airIdPlaceholder'></ejs-multiselect>
<ejs-multiselect id='airmd' (change)="OnChangeair($event)" [(value)]="airManagingDirectorModel" [dataSource]='airManagingDirectorData' [fields]='airManagingDirectorFields' [allowFiltering]='true' [placeholder]='airManagingDirectorPlaceholder'></ejs-multiselect>```

This picture shows all AIR id but the list keeps on flickering. I think it keeps on changing the list due to the change event.
Any help would be appreciated. Thank you

Body:
I am using multi select dropdown with dependent dropdowns like below

Populating these list via api. Now if i select one value i am calling (change) function of angular to get the id of the dropdown and then calling a function to change other dropdown values.

OnChangeair(e){
  if(e.element.id=='airid')
  this.filterAirId(this.airIDModel)
  else if(e.element.id=='airlead')
  this.filterLead(this.airLeadModel)
  else if(e.element.id=='airmd')
  this.filterManagingDirector(this.airManagingDirectorModel)
  else if(e.element.id=='airmanager')
  this.filterManager(this.airManagerModel)
  else if(e.element.id=='airaim')
  this.filterAIM(this.airAIMProjectNameModel)
  else if(e.element.id=='airse')
  this.filterServiceArea(this.airServiceAreaModel)
}

Function to change the list is

filterAirId(airid){
  if(airid.length == 0){
    this.getAIRData();
  }
  else{
    let finalArr = [];
    airid.forEach((item)=>{
      var name = this.airData.filter( el=>el.AIRID == item );
      this.airData.push.apply(finalArr,name);
  });
  this.airManagingDirectorData=finalArr;
  this.airServiceAreaData = finalArr;
  this.airLeadData = finalArr;
  this.airManagerData = finalArr;
  this.airAIMProjectNameData = finalArr;
  console.log(finalArr);
  }
  //this.assetData = this.assetData.filter((item) => item.AIRID == airid);
}

Now this works when i select any one of them others get correctly populated. But when i select another field the previous one's field gets replaced and my change event gets fired continuously resulting in

Angular HTML

<ejs-multiselect id='airid'  (change)="OnChangeair($event)"  [(value)]="airIDModel" [dataSource]='airIDData' [fields]='airIdFields' [allowFiltering]='true' [placeholder]='airIdPlaceholder'></ejs-multiselect>
<ejs-multiselect id='airmd' (change)="OnChangeair($event)" [(value)]="airManagingDirectorModel" [dataSource]='airManagingDirectorData' [fields]='airManagingDirectorFields' [allowFiltering]='true' [placeholder]='airManagingDirectorPlaceholder'></ejs-multiselect>

This picture shows all AIR id but the list keeps on flickering. I think it keeps on changing the list due to the change event.
Any help would be appreciated. Thank you


问:
CSV file data sorting using sed command
```<code>tet(44)1,tet(37)1,oqxB1,VanX-D4,VanX-D4,tet(O)2,aadA51,VanR-G1,
</code>```

How can I remove everything that comes only after the bracket () for each data, by using sed?

As these data are not in any pattern, deleting only characters after the bracket not working at all.

Title: CSV file data sorting using sed command

Body:
tet(44)1,tet(37)1,oqxB1,VanX-D4,VanX-D4,tet(O)2,aadA51,VanR-G1,

How can I remove everything that comes only after the bracket () for each data, by using sed?

As these data are not in any pattern, deleting only characters after the bracket not working at all.


问:
How to upload image in ckeditor using Reactjs
I am working in Reactjs and i am using nextjs, Right now i am trying to integrate ckeditor,Everything is working fine but right now i am unable to save image,whenever i select any image then nothing happen,So how can i upload image using ckeditor ? I tried with following code inside component folder ( file name is ckeditor.js)</p>
```<code>import React, { useEffect, useRef } from "react";export default function CKeditor({ onChange, editorLoaded, name, value }) {
    const editorRef = useRef();
    const { CKEditor, ClassicEditor } = editorRef.current || {};useEffect(() => {
    editorRef.current = {
         CKEditor: require("@ckeditor/ckeditor5-react").CKEditor,
         ClassicEditor: require("@ckeditor/ckeditor5-build-classic")
        };
    }, []);
    return (
        <>
            {editorLoaded ? (
                <CKEditor
                    type=""
                    name={name}
                    editor={ClassicEditor}
                    data={value}
                    onChange={(event, editor) => {
                        const data = editor.getData();
                        onChange(data);
                    }}
                />
            ) : (
                <div>Editor loading</div>
            )}
        </>
    )
}
</code>```

Body:
I am working in Reactjs and i am using nextjs, Right now i am trying to integrate ckeditor,Everything is working fine but right now i am unable to save image,whenever i select any image then nothing happen,So how can i upload image using ckeditor ? I tried with following code inside component folder ( file name is ckeditor.js)

import React, { useEffect, useRef } from "react";export default function CKeditor({ onChange, editorLoaded, name, value }) {
    const editorRef = useRef();
    const { CKEditor, ClassicEditor } = editorRef.current || {};useEffect(() => {
    editorRef.current = {
         CKEditor: require("@ckeditor/ckeditor5-react").CKEditor,
         ClassicEditor: require("@ckeditor/ckeditor5-build-classic")
        };
    }, []);
    return (
        <>
            {editorLoaded ? (
                <CKEditor
                    type=""
                    name={name}
                    editor={ClassicEditor}
                    data={value}
                    onChange={(event, editor) => {
                        const data = editor.getData();
                        onChange(data);
                    }}
                />
            ) : (

Editor loading

            )}
        </>
    )
}


问:
Queries with streaming sources must be executed with writeStream.start();
I'm new in Spark Structured Streaming, so I cannot understand the problem.I've implemented with HBaseSinkProvider... Can you please help me with it?

Spark verdion: 2.4.0,
scala.version: 2.11.8,
com.hortonworks.shc-core: 1.1.1-2.1-s_2.11
spark-sql-kafka-0-10_2.11

```<code>rows = spark \
.readStream \
.format('kafka') \
.option('kafka.bootstrap.servers', brokers) \
.option('subscribe', topic) \
.option('group.id', group_id) \
.option('maxOffsetsPerTrigger', 1000) \
.option("startingOffsets", "earliest") \
.load()
</code>```

rows.printSchema()

```<code>schema = StructType([ \
    StructField('consumer_id', StringType(), False), \
    StructField('audit_system_id', StringType(), False), \
    StructField('object_path', StringType(), True), \
    StructField('object_type', StringType(), False), \
    StructField('what_action', StringType(), False), \
    StructField('when', LongType(), False), \
    StructField('where', StringType(), False), \
    StructField('who', StringType(), True), \
    StructField('workstation', StringType(), True) \
])

val udf_decode_avro = udf(decode_avro, schema)
values = rows.select('value')
values.printSchema()
changes = values.withColumn('change',
  udf_decode_avro(col('value'))).select('change.*')
</code>```

changes.printSchema()

```<code>change_catalog ={"table":{
    "namespace": "default",
    "name": "changes",
    "tableCoder": "PrimitiveType"
},
"rowkey": "consumer_id",
"columns":{
    "consumer_id": {"cf": "rowkey", "col": "consumer_id", "type": "string"},
    "audit_system_id": {"cf": "d", "col": "audit_system_id", "type": "string"},
    "object_path": {"cf": "d", "col": "object_path", "type": "string"},
    "object_type": {"cf": "d", "col": "object_type", "type": "string"},
    "what_action": {"cf": "d", "col": "what_action", "type": "string"},
    "when": {"cf": "t", "col": "when", "type": "bigint"},
    "where": {"cf": "d", "col": "where", "type": "string"},
    "who": {"cf": "d", "col": "who", "type": "string"},
    "workstation": {"cf": "d", "col": "workstation", "type": "string"}}}
query = changes
.writeStream
.format('HBase.HBaseSinkProvider')
.option('hbasecat', change_catalog)
.option("checkpointLocation", '/tmp/checkpoint')
.outputMode("append")
.start().awaitTermination()
</code>```

ERROR

Caused by: org.apache.spark.sql.AnalysisException: Queries with streaming sources must be executed with writeStream.start();;
at org.apache.spark.sql.catalyst.analysis.UnsupportedOperationChecker$.org$apache$spark$sql$catalyst$analysis$UnsupportedOperationChecker$$throwError(UnsupportedOperationChecker.scala:389)
at org.apache.spark.sql.catalyst.analysis.UnsupportedOperationChecker$$anonfun$checkForBatch$1.apply(UnsupportedOperationChecker.scala:38)
at org.apache.spark.sql.catalyst.analysis.UnsupportedOperationChecker$$anonfun$checkForBatch$1.apply(UnsupportedOperationChecker.scala:36)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:127)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)

Body:
I'm new in Spark Structured Streaming, so I cannot understand the problem.I've implemented with HBaseSinkProvider... Can you please help me with it?

Spark verdion: 2.4.0,
scala.version: 2.11.8,
com.hortonworks.shc-core: 1.1.1-2.1-s_2.11
spark-sql-kafka-0-10_2.11

rows = spark \
.readStream \
.format('kafka') \
.option('kafka.bootstrap.servers', brokers) \
.option('subscribe', topic) \
.option('group.id', group_id) \
.option('maxOffsetsPerTrigger', 1000) \
.option("startingOffsets", "earliest") \
.load()

rows.printSchema()

schema = StructType([ \
    StructField('consumer_id', StringType(), False), \
    StructField('audit_system_id', StringType(), False), \
    StructField('object_path', StringType(), True), \
    StructField('object_type', StringType(), False), \
    StructField('what_action', StringType(), False), \
    StructField('when', LongType(), False), \
    StructField('where', StringType(), False), \
    StructField('who', StringType(), True), \
    StructField('workstation', StringType(), True) \
])

val udf_decode_avro = udf(decode_avro, schema)
values = rows.select('value')
values.printSchema()
changes = values.withColumn('change',
  udf_decode_avro(col('value'))).select('change.*')

changes.printSchema()

change_catalog ={"table":{
    "namespace": "default",
    "name": "changes",
    "tableCoder": "PrimitiveType"
},
"rowkey": "consumer_id",
"columns":{
    "consumer_id": {"cf": "rowkey", "col": "consumer_id", "type": "string"},
    "audit_system_id": {"cf": "d", "col": "audit_system_id", "type": "string"},
    "object_path": {"cf": "d", "col": "object_path", "type": "string"},
    "object_type": {"cf": "d", "col": "object_type", "type": "string"},
    "what_action": {"cf": "d", "col": "what_action", "type": "string"},
    "when": {"cf": "t", "col": "when", "type": "bigint"},
    "where": {"cf": "d", "col": "where", "type": "string"},
    "who": {"cf": "d", "col": "who", "type": "string"},
    "workstation": {"cf": "d", "col": "workstation", "type": "string"}}}
query = changes
.writeStream
.format('HBase.HBaseSinkProvider')
.option('hbasecat', change_catalog)
.option("checkpointLocation", '/tmp/checkpoint')
.outputMode("append")
.start().awaitTermination()

ERROR

Caused by: org.apache.spark.sql.AnalysisException: Queries with streaming sources must be executed with writeStream.start();;
at org.apache.spark.sql.catalyst.analysis.UnsupportedOperationChecker$.org$apache$spark$sql$catalyst$analysis$UnsupportedOperationChecker$$throwError(UnsupportedOperationChecker.scala:389)
at org.apache.spark.sql.catalyst.analysis.UnsupportedOperationChecker$$anonfun$checkForBatch$1.apply(UnsupportedOperationChecker.scala:38)
at org.apache.spark.sql.catalyst.analysis.UnsupportedOperationChecker$$anonfun$checkForBatch$1.apply(UnsupportedOperationChecker.scala:36)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:127)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$foreachUp$1.apply(TreeNode.scala:126)


问:
How to join the circles and line to create line segment in fabric js?
[enter image description here](https://i.stack.imgur.com/HEjWG.png)

I am trying to join the circles and line to create line segment in fabric js but unable to do so getting error :-

Element implicitly has an 'any' type because expression of type 'circle1' cant be used to index type 'line'.

```<code>circle1['line'] = circle2['line'] = line;
  line['circle1'] = circle1;
  line['circle2'] = circle2;
</code>```

I am using these dependencies :

Angular CLI : 14.2.7,

Node : 16.14.0,

Package Manager : npm 8.3.1

Angular: 14.2.8

... animations, common, compiler, compiler-cli, core, forms

... platform-browser, platform-browser-dynamic, router.

```<code>"fabric": "^5.2.4",
 "@types/fabric": "^4.5.12",
</code>```

[enter image description here](https://i.stack.imgur.com/9HbgV.png)

I am trying to create line segment by joining two circles an a line in fabric js .
Getting the error which I have explained before.

Body:
[enter image description here](https://i.stack.imgur.com/HEjWG.png)

I am trying to join the circles and line to create line segment in fabric js but unable to do so getting error :-

Element implicitly has an 'any' type because expression of type 'circle1' cant be used to index type 'line'.

circle1['line'] = circle2['line'] = line;
  line['circle1'] = circle1;
  line['circle2'] = circle2;

I am using these dependencies :

Angular CLI : 14.2.7,

Node : 16.14.0,

Package Manager : npm 8.3.1

Angular: 14.2.8

... animations, common, compiler, compiler-cli, core, forms

... platform-browser, platform-browser-dynamic, router.

"fabric": "^5.2.4",
 "@types/fabric": "^4.5.12",

[enter image description here](https://i.stack.imgur.com/9HbgV.png)

I am trying to create line segment by joining two circles an a line in fabric js .
Getting the error which I have explained before.


问:
getting list of data from list of list json vue
I need to get filter data but it works when its only list of data not list in list.
There is some lists of object name starting with number1 with list but  need the data inside number and save it in array. Using smart table vuejs so if i get json data it will work since i did similar things.
This is my code</p>
```<code>let result = [];
let response = await this.$axios.post("api");
for (item in response.data.list){
 result.push(response.data.list[item][0];
}
</code>```
```<code>{
    "list": {
        "number1": [
            {},
        ],
        "number2": [
            {}
        ],
        "number3": [
            {}
        ],
     etc...

    }

</code>```
```<code><v-table
//it is within thead and
:data="result"
:filters= "filters">
<input v-model="filters.name.value"
<v-table/>
</code>```
```<code>data:function(){
return {
result: [];
filters: {
... //other fields same as below
        name: { value: "", keys: ["name"] },
        ...

      },
}
}
</code>```

Body:
I need to get filter data but it works when its only list of data not list in list.
There is some lists of object name starting with number1 with list but  need the data inside number and save it in array. Using smart table vuejs so if i get json data it will work since i did similar things.
This is my code

let result = [];
let response = await this.$axios.post("api");
for (item in response.data.list){
 result.push(response.data.list[item][0];
}

{
    "list": {
        "number1": [
            {},
        ],
        "number2": [
            {}
        ],
        "number3": [
            {}
        ],
     etc...

    }

<v-table
//it is within thead and
:data="result"
:filters= "filters">
<input v-model="filters.name.value"
<v-table/>

data:function(){
return {
result: [];
filters: {
... //other fields same as below
        name: { value: "", keys: ["name"] },
        ...

      },
}
}


问:
Convert a string into array of strings
In a postgresql query, I would like to turn a given string, split it by comma, and return the results as an array of strings.

Input:

```<code>'a,b,c'
</code>```

Expected output:

```<code>{'a','b','c'}
</code>```

Using STRING_TO_ARRAY('a,b,c') yields the result {a,b,c} which is an array of objects, not strings.

How can I achieve array of strings?

Title: Convert a string into array of strings

Body:
In a postgresql query, I would like to turn a given string, split it by comma, and return the results as an array of strings.

Input:

'a,b,c'

Expected output:

{'a','b','c'}

Using STRING_TO_ARRAY('a,b,c') yields the result {a,b,c} which is an array of objects, not strings.

How can I achieve array of strings?


问:
Problem using debugging with c language and cygwin
I've installed visual studio code version 1.74.0 and I'm using it for some testing and development with c language and Cygwin, for building and running works fine, but the problem arises when I try to use the debugger, I have this message "The editor could not be opened because the file was not found", basically it's not able to find the source file where there are also the breakpoints.

The correct source file is: "C:\Users\PG005856\Documents\clanguage\projects\ctest\test.c" but it tries to find in this path :
"C:\Users\PG005856\Documents\clanguage\projects\ctest\C\Users\PG005856\Documents\clanguage\projects\ctest\test.c"

It tries to recreate the same path inside the workspace, this is my launch.json file :

{
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/test.exe",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:/MyProgram/cygwin64/bin/gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}
```

Anyone have any clue about this problem ? i've tried to search online but with no luck.

Thanks,
Tommaso.

Body:
I've installed visual studio code version 1.74.0 and I'm using it for some testing and development with c language and Cygwin, for building and running works fine, but the problem arises when I try to use the debugger, I have this message "The editor could not be opened because the file was not found", basically it's not able to find the source file where there are also the breakpoints.

The correct source file is: "C:\Users\PG005856\Documents\clanguage\projects\ctest\test.c" but it tries to find in this path :
"C:\Users\PG005856\Documents\clanguage\projects\ctest\C\Users\PG005856\Documents\clanguage\projects\ctest\test.c"

It tries to recreate the same path inside the workspace, this is my launch.json file :

{
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/test.exe",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:/MyProgram/cygwin64/bin/gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

Anyone have any clue about this problem ? i've tried to search online but with no luck.

Thanks,
Tommaso.


问:
Accessing methods in $root Vue 3 with typescript
I have a component. From this component I need to run a methods resides in root component to view loading screen anytime fetch request was made. The way I usually did was to access root methods using

this.$root.someMethod()

It works fine with JS. But it throwing me an error saying "Property 'someMethod' does not exist on type 'ComponentPublicInstance'" when I'm using TS.