问:
Question about interaction between a Gantt chart and a bar chart using python Altair
I'm trying to generate a Gantt chart (c1) and a bar chart (c2) using Altair.

These two charts are from data that happens in the same time period. So what I want to achieve is when a segment from Gantt chart is selected, the scale (x axis) of the bar chart gets updated to the start and end time of the selected segment.

The code I have currently is as following.

For c1, I tried adding a selection_single with encodings=['x'], and for c2 I added domain=c1_select.ref() for x axis.

But this doesn't seem to work, since I think with encodings=['x'], when I select a segment, only the selected segment's x (start) value gets picked up by c2, resulting in c2's x axis changing to only having 1 value.

I'm wondering if there's a way set c2's x axis's domain to (c1_selected.x, c1_selected.x2) when a segment is selected from c1?

Thanks a lot for helping!

import altair as alt
import pandas as pd
import numpy as np
import random

c1_select = alt.selection_single(on='mouseover', encodings=['x'])

top = pd.DataFrame({
    'start': np.arange(0, 200, 5),
    'end': np.arange(10, 210, 5),
    'taskID': np.arange(40) % 5
})

c1 = alt.Chart(top).mark_bar().encode(
    x=alt.X("start", scale=alt.Scale(domain=(0, 220))),
    x2='end',
    y=alt.Y('taskID:O', sort='x', axis=None),
).properties(
    width=2000,
    height=80
).add_selection(c1_select)

bottom = pd.DataFrame()
bottom['ts'] = np.random.randint(0, 210, size=(200))
bottom['cnt'] = np.random.randint(0, 10, size=(len(bottom), 1))
bottom['type'] = random.choices(['a', 'b', 'c'], k=len(bottom))

c2 = alt.Chart(bottom).mark_bar().encode(
    x=alt.X("ts", scale=alt.Scale(domain=c1_select.ref())),
    y=alt.Y('sum(cnt)'),
    color='type'
).properties(
    width=2000,
    height=80
)

c1 & c2
```


来源: stackexchange

问:
The width of the viewport expanded after adding an image and I'm unable to resize it
I added an image which was initially wider than the width of the viewport, causing the viewport to scroll horizontally. After significantly shrinking the image, I noticed the viewport still maintained the larger size and continued to scroll horizontally. The parent div also maintained the original size of the image. I want to understand why this is occuring and how I can get the viewport back to its original size. Thanks!
Here is the code.</p>
```<code>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css"
        integrity="sha512-MV7K8+y+gLIBoVD59lQIYicR65iaqukzvf/nwasF0nqhPay5w/9lJmVM2hMDcnK1OnMGCdVK+iQrJ7lzPJQd1w=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
    <title>Document</title>
</head>

<body>

    <div class="container">
        <img src="./images/project-4.jpg">
    </div>
</body>

</html>

*{
    margin: 0;
    padding: 0;
}

.container {
    border: solid green;
}

img {
    width: 200px;
    height: 200px;
}

</code>```

ContentLicense: CC BY-SA 4.0

Body:
I added an image which was initially wider than the width of the viewport, causing the viewport to scroll horizontally. After significantly shrinking the image, I noticed the viewport still maintained the larger size and continued to scroll horizontally. The parent div also maintained the original size of the image. I want to understand why this is occuring and how I can get the viewport back to its original size. Thanks!
Here is the code.

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css"
        integrity="sha512-MV7K8+y+gLIBoVD59lQIYicR65iaqukzvf/nwasF0nqhPay5w/9lJmVM2hMDcnK1OnMGCdVK+iQrJ7lzPJQd1w=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
    <title>Document</title>

*{
    margin: 0;
    padding: 0;
}

.container {
    border: solid green;
}

img {
    width: 200px;
    height: 200px;
}


问:
Is there any way to copy the selection‘ icon file to clipboard in Alfred Workflow？
I am working on develop a workflow and it needs to copy the icon of selection to clipboard.The icon files are stored in the workflow folder.

so can i do that?

btw, I am using scriptfilter and use the JXA, the filtered results return in JSON.


问:
! object 'linear_reg' of mode 'function' was not found
I have the following function built, which fails with devtools::check() with the following message:

> fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
  Error in `dplyr::mutate()`:
  ! Problem while computing `.model_spec = purrr::pmap(dplyr::cur_data(),
    ~match.fun(..3)(mode = ..2, engine = ..1))`.
  Caused by error in `get()`:
  ! object 'linear_reg' of mode 'function' was not found
  Backtrace:
       ▆
    1. ├─tidyaml::fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
    2. │ └─mod_filtered_tbl %>% ...
    3. ├─dplyr::mutate(...)
    4. ├─dplyr:::mutate.data.frame(...)
    5. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), caller_env = caller_env())
    6. │   ├─base::withCallingHandlers(...)
    7. │   └─mask$eval_all_mutate(quo)
    8. ├─purrr::pmap(dplyr::cur_data(), ~match.fun(..3)(mode = ..2, engine = ..1))
    9. │ └─tidyaml (local) .f(...)
   10. │   └─base::match.fun(..3)
   11. │     └─base::get(as.character(FUN), mode = "function", envir = envir)
   12. └─base::.handleSimpleError(...)
   13.   └─dplyr (local) h(simpleError(msg, call))
   14.     └─rlang::abort(...)
  Execution halted
```
<p>Here is the function:</p>
<pre class="lang-r prettyprint-override"><code>fast_regression_parsnip_spec_tbl <- function(.parsnip_fns = "all",
                                             .parsnip_eng = "all") {

  # Thank you https://stackoverflow.com/questions/74691333/build-a-tibble-of-parsnip-model-calls-with-match-fun/74691529#74691529
  # Tidyeval ----
  pf <- list(.parsnip_fns) %>%
    purrr::flatten_chr()
  pe <- list(.parsnip_eng) %>%
    purrr::flatten_chr()

  # Make tibble
  mod_tbl <- dplyr::tibble(
    .parsnip_engine = c(
      "lm",
      "brulee",
      "gee",
      "glm",
      "glmer",
      "glmnet",
      "gls",
      "h2o",
      "keras",
      "lme",
      "lmer",
      "spark",
      "stan",
      "stan_glmer",
      "Cubist",
      "glm",
      "gee",
      "glmer",
      "glmnet",
      "h2o",
      "hurdle",
      "stan",
      "stan_glmer",
      "zeroinfl",
      "survival",
      "flexsurv",
      "flexsurvspline"
    ),
    .parsnip_mode = c(
      rep("regression", 24),
      rep("censored regression", 3)
    ),
    .parsnip_fns = c(
      rep("linear_reg", 14),
      "cubist_rules",
      rep("poisson_reg",9),
      rep("survival_reg", 3)
    )
  )

  # Filter ----
  if (!"all" %in% pe){
    mod_tbl <- mod_tbl %>%
      dplyr::filter(.parsnip_engine %in% pe)
  }

  if (!"all" %in% pf){
    mod_tbl <- mod_tbl %>%
      dplyr::filter(.parsnip_fns %in% pf)
  }

  mod_filtered_tbl <- mod_tbl

  mod_spec_tbl <- mod_filtered_tbl %>%
    dplyr::mutate(
      .model_spec = purrr::pmap(
        dplyr::cur_data(),
        ~ match.fun(..3)(mode = ..2, engine = ..1)
      )
    )

  # Return ----
  class(mod_spec_tbl) <- c("fst_reg_spec_tbl", class(mod_spec_tbl))
  attr(mod_spec_tbl, ".parsnip_engines") <- .parsnip_eng
  attr(mod_spec_tbl, ".parsnip_functions") <- .parsnip_fns

  return(mod_spec_tbl)

}
</code>```

Not sure how to proceed with this. I did try to include loadNameSpace(package = "parsnip") to the function but that did not do what I thought it would.

UPDATE
I changed ~ match.fun... to ~ get... not entirely sure why this works so I'm leaving open, as I also here that using get is sort of hacky and potentially dangerous.

UPDATE

Here is my session info:

> library(tidyaml)
> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] tidyaml_0.0.0.9000

loaded via a namespace (and not attached):
 [1] parsnip_1.0.3    rstudioapi_0.14  magrittr_2.0.3   tidyselect_1.2.0 munsell_0.5.0
 [6] colorspace_2.0-3 R6_2.5.1         rlang_1.0.6      fansi_1.0.3      dplyr_1.0.10
[11] tools_4.2.1      hardhat_1.2.0    grid_4.2.1       gtable_0.3.1     utf8_1.2.2
[16] cli_3.4.1        DBI_1.1.3        assertthat_0.2.1 tibble_3.1.8     lifecycle_1.0.3
[21] tidyr_1.2.1      purrr_0.3.5      ggplot2_3.4.0    vctrs_0.5.1      glue_1.6.2
[26] compiler_4.2.1   pillar_1.8.1     generics_0.1.3   scales_1.2.1     pkgconfig_2.0.3
```
<p>Here are the full results of <code>devtools::check()</code> where <code>match.fun</code> is implemented.</p>
<pre class="lang-r prettyprint-override"><code>==> devtools::check()

══ Documenting ═══════════════════════════════════════════════════════════════════════════════════════════
ℹ Updating tidyaml documentation
ℹ Loading tidyaml

══ Building ══════════════════════════════════════════════════════════════════════════════════════════════
Setting env vars:
• CFLAGS    : -Wall -pedantic -fdiagnostics-color=always
• CXXFLAGS  : -Wall -pedantic -fdiagnostics-color=always
• CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX14FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX17FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX20FLAGS: -Wall -pedantic -fdiagnostics-color=always
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file 'C:\Users\steve\Documents\GitHub\tidyaml/DESCRIPTION' ...
─  preparing 'tidyaml': (655ms)
✔  checking DESCRIPTION meta-information ...
─  installing the package to build vignettes
✔  creating vignettes (5.6s)
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building 'tidyaml_0.0.0.9000.tar.gz'

══ Checking ══════════════════════════════════════════════════════════════════════════════════════════════
Setting env vars:
• _R_CHECK_CRAN_INCOMING_REMOTE_               : FALSE
• _R_CHECK_CRAN_INCOMING_                      : FALSE
• _R_CHECK_FORCE_SUGGESTS_                     : FALSE
• _R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_: FALSE
• NOT_CRAN                                     : true
── R CMD check ───────────────────────────────────────────────────────────────────────────────────────────
─  using log directory 'C:/Users/steve/Documents/GitHub/tidyaml.Rcheck'
─  using R version 4.2.1 (2022-06-23 ucrt)
─  using platform: x86_64-w64-mingw32 (64-bit)
─  using session charset: UTF-8
─  using options '--no-manual --as-cran'
✔  checking for file 'tidyaml/DESCRIPTION'
─  this is package 'tidyaml' version '0.0.0.9000'
─  package encoding: UTF-8
✔  checking package namespace information
✔  checking package dependencies (5.2s)
✔  checking if this is a source package ...
✔  checking if there is a namespace
✔  checking for executable files (349ms)
✔  checking for hidden files and directories ...
✔  checking for portable file names
✔  checking serialization versions
✔  checking whether package 'tidyaml' can be installed (3.5s)
✔  checking installed package size ...
✔  checking package directory
✔  checking for future file timestamps ...
✔  checking 'build' directory ...
✔  checking DESCRIPTION meta-information ...
✔  checking top-level files
✔  checking for left-over files ...
✔  checking index information ...
✔  checking package subdirectories ...
✔  checking R files for non-ASCII characters ...
✔  checking R files for syntax errors ...
✔  checking whether the package can be loaded (890ms)
✔  checking whether the package can be loaded with stated dependencies (770ms)
✔  checking whether the package can be unloaded cleanly (773ms)
✔  checking whether the namespace can be loaded with stated dependencies (790ms)
✔  checking whether the namespace can be unloaded cleanly (991ms)
✔  checking loading without being on the library search path (977ms)
✔  checking dependencies in R code (776ms)
✔  checking S3 generic/method consistency (1.2s)
✔  checking replacement functions (768ms)
✔  checking foreign function calls (775ms)
✔  checking R code for possible problems (5.2s)
✔  checking Rd files ...
✔  checking Rd metadata ...
✔  checking Rd line widths ...
✔  checking Rd cross-references ...
✔  checking for missing documentation entries (774ms)
✔  checking for code/documentation mismatches (2.3s)
✔  checking Rd \usage sections (1.4s)
✔  checking Rd contents ...
✔  checking for unstated dependencies in examples ...
✔  checking installed files from 'inst/doc'
✔  checking files in 'vignettes'
E  checking examples (2.2s)
   Running examples in 'tidyaml-Ex.R' failed
   The error most likely occurred in:

   > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
   > ### Name: fast_regression_parsnip_spec_tbl
   > ### Title: Utility Regression call to 'parsnip'
   > ### Aliases: fast_regression_parsnip_spec_tbl
   >
   > ### ** Examples
   >
   > fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
   Error in `dplyr::mutate()`:
   ! Problem while computing `.model_spec = purrr::pmap(dplyr::cur_data(),
     ~match.fun(..3)(mode = ..2, engine = ..1))`.
   Caused by error in `get()`:
   ! object 'linear_reg' of mode 'function' was not found
   Backtrace:
        ▆
     1. ├─tidyaml::fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
     2. │ └─mod_filtered_tbl %>% ...
     3. ├─dplyr::mutate(...)
     4. ├─dplyr:::mutate.data.frame(...)
     5. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), caller_env = caller_env())
     6. │   ├─base::withCallingHandlers(...)
     7. │   └─mask$eval_all_mutate(quo)
     8. ├─purrr::pmap(dplyr::cur_data(), ~match.fun(..3)(mode = ..2, engine = ..1))
     9. │ └─tidyaml (local) .f(...)
    10. │   └─base::match.fun(..3)
    11. │     └─base::get(as.character(FUN), mode = "function", envir = envir)
    12. └─base::.handleSimpleError(...)
    13.   └─dplyr (local) h(simpleError(msg, call))
    14.     └─rlang::abort(...)
   Execution halted
✔  checking for unstated dependencies in vignettes ...
✔  checking package vignettes in 'inst/doc' ...
✔  checking re-building of vignette outputs (1.8s)
✔  checking for non-standard things in the check directory
✔  checking for detritus in the temp directory ...

   See
     'C:/Users/steve/Documents/GitHub/tidyaml.Rcheck/00check.log'
   for details.

── R CMD check results ─────────────────────────────────────────────────────────── tidyaml 0.0.0.9000 ────
Duration: 35.9s

❯ checking examples ... ERROR
  Running examples in 'tidyaml-Ex.R' failed
  The error most likely occurred in:

  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: fast_regression_parsnip_spec_tbl
  > ### Title: Utility Regression call to 'parsnip'
  > ### Aliases: fast_regression_parsnip_spec_tbl
  >
  > ### ** Examples
  >
  > fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
  Error in `dplyr::mutate()`:
  ! Problem while computing `.model_spec = purrr::pmap(dplyr::cur_data(),
    ~match.fun(..3)(mode = ..2, engine = ..1))`.
  Caused by error in `get()`:
  ! object 'linear_reg' of mode 'function' was not found
  Backtrace:
       ▆
    1. ├─tidyaml::fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
    2. │ └─mod_filtered_tbl %>% ...
    3. ├─dplyr::mutate(...)
    4. ├─dplyr:::mutate.data.frame(...)
    5. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), caller_env = caller_env())
    6. │   ├─base::withCallingHandlers(...)
    7. │   └─mask$eval_all_mutate(quo)
    8. ├─purrr::pmap(dplyr::cur_data(), ~match.fun(..3)(mode = ..2, engine = ..1))
    9. │ └─tidyaml (local) .f(...)
   10. │   └─base::match.fun(..3)
   11. │     └─base::get(as.character(FUN), mode = "function", envir = envir)
   12. └─base::.handleSimpleError(...)
   13.   └─dplyr (local) h(simpleError(msg, call))
   14.     └─rlang::abort(...)
  Execution halted

1 error ✖ | 0 warnings ✔ | 0 notes ✔
Error: R CMD check found ERRORs
Execution halted

Exited with status 1.

parsn

        #~ get(..3)(mode = ..2, engine = ..1)

</code>```

Body:
I have the following function built, which fails with devtools::check() with the following message:

> fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
  Error in `dplyr::mutate()`:
  ! Problem while computing `.model_spec = purrr::pmap(dplyr::cur_data(),
    ~match.fun(..3)(mode = ..2, engine = ..1))`.
  Caused by error in `get()`:
  ! object 'linear_reg' of mode 'function' was not found
  Backtrace:
       ▆
    1. ├─tidyaml::fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
    2. │ └─mod_filtered_tbl %>% ...
    3. ├─dplyr::mutate(...)
    4. ├─dplyr:::mutate.data.frame(...)
    5. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), caller_env = caller_env())
    6. │   ├─base::withCallingHandlers(...)
    7. │   └─mask$eval_all_mutate(quo)
    8. ├─purrr::pmap(dplyr::cur_data(), ~match.fun(..3)(mode = ..2, engine = ..1))
    9. │ └─tidyaml (local) .f(...)
   10. │   └─base::match.fun(..3)
   11. │     └─base::get(as.character(FUN), mode = "function", envir = envir)
   12. └─base::.handleSimpleError(...)
   13.   └─dplyr (local) h(simpleError(msg, call))
   14.     └─rlang::abort(...)
  Execution halted

Here is the function:

fast_regression_parsnip_spec_tbl <- function(.parsnip_fns = "all",
                                             .parsnip_eng = "all") {

  # Thank you https://stackoverflow.com/questions/74691333/build-a-tibble-of-parsnip-model-calls-with-match-fun/74691529#74691529
  # Tidyeval ----
  pf <- list(.parsnip_fns) %>%
    purrr::flatten_chr()
  pe <- list(.parsnip_eng) %>%
    purrr::flatten_chr()

  # Make tibble
  mod_tbl <- dplyr::tibble(
    .parsnip_engine = c(
      "lm",
      "brulee",
      "gee",
      "glm",
      "glmer",
      "glmnet",
      "gls",
      "h2o",
      "keras",
      "lme",
      "lmer",
      "spark",
      "stan",
      "stan_glmer",
      "Cubist",
      "glm",
      "gee",
      "glmer",
      "glmnet",
      "h2o",
      "hurdle",
      "stan",
      "stan_glmer",
      "zeroinfl",
      "survival",
      "flexsurv",
      "flexsurvspline"
    ),
    .parsnip_mode = c(
      rep("regression", 24),
      rep("censored regression", 3)
    ),
    .parsnip_fns = c(
      rep("linear_reg", 14),
      "cubist_rules",
      rep("poisson_reg",9),
      rep("survival_reg", 3)
    )
  )

  # Filter ----
  if (!"all" %in% pe){
    mod_tbl <- mod_tbl %>%
      dplyr::filter(.parsnip_engine %in% pe)
  }

  if (!"all" %in% pf){
    mod_tbl <- mod_tbl %>%
      dplyr::filter(.parsnip_fns %in% pf)
  }

  mod_filtered_tbl <- mod_tbl

  mod_spec_tbl <- mod_filtered_tbl %>%
    dplyr::mutate(
      .model_spec = purrr::pmap(
        dplyr::cur_data(),
        ~ match.fun(..3)(mode = ..2, engine = ..1)
      )
    )

  # Return ----
  class(mod_spec_tbl) <- c("fst_reg_spec_tbl", class(mod_spec_tbl))
  attr(mod_spec_tbl, ".parsnip_engines") <- .parsnip_eng
  attr(mod_spec_tbl, ".parsnip_functions") <- .parsnip_fns

  return(mod_spec_tbl)

}

Not sure how to proceed with this. I did try to include loadNameSpace(package = "parsnip") to the function but that did not do what I thought it would.

UPDATE
I changed ~ match.fun... to ~ get... not entirely sure why this works so I'm leaving open, as I also here that using get is sort of hacky and potentially dangerous.

UPDATE

Here is my session info:

> library(tidyaml)
> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] tidyaml_0.0.0.9000

loaded via a namespace (and not attached):
 [1] parsnip_1.0.3    rstudioapi_0.14  magrittr_2.0.3   tidyselect_1.2.0 munsell_0.5.0
 [6] colorspace_2.0-3 R6_2.5.1         rlang_1.0.6      fansi_1.0.3      dplyr_1.0.10
[11] tools_4.2.1      hardhat_1.2.0    grid_4.2.1       gtable_0.3.1     utf8_1.2.2
[16] cli_3.4.1        DBI_1.1.3        assertthat_0.2.1 tibble_3.1.8     lifecycle_1.0.3
[21] tidyr_1.2.1      purrr_0.3.5      ggplot2_3.4.0    vctrs_0.5.1      glue_1.6.2
[26] compiler_4.2.1   pillar_1.8.1     generics_0.1.3   scales_1.2.1     pkgconfig_2.0.3

Here are the full results of devtools::check() where match.fun is implemented.

==> devtools::check()

══ Documenting ═══════════════════════════════════════════════════════════════════════════════════════════
ℹ Updating tidyaml documentation
ℹ Loading tidyaml

══ Building ══════════════════════════════════════════════════════════════════════════════════════════════
Setting env vars:
• CFLAGS    : -Wall -pedantic -fdiagnostics-color=always
• CXXFLAGS  : -Wall -pedantic -fdiagnostics-color=always
• CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX14FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX17FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX20FLAGS: -Wall -pedantic -fdiagnostics-color=always
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file 'C:\Users\steve\Documents\GitHub\tidyaml/DESCRIPTION' ...
─  preparing 'tidyaml': (655ms)
✔  checking DESCRIPTION meta-information ...
─  installing the package to build vignettes
✔  creating vignettes (5.6s)
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building 'tidyaml_0.0.0.9000.tar.gz'

══ Checking ══════════════════════════════════════════════════════════════════════════════════════════════
Setting env vars:
• _R_CHECK_CRAN_INCOMING_REMOTE_               : FALSE
• _R_CHECK_CRAN_INCOMING_                      : FALSE
• _R_CHECK_FORCE_SUGGESTS_                     : FALSE
• _R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_: FALSE
• NOT_CRAN                                     : true
── R CMD check ───────────────────────────────────────────────────────────────────────────────────────────
─  using log directory 'C:/Users/steve/Documents/GitHub/tidyaml.Rcheck'
─  using R version 4.2.1 (2022-06-23 ucrt)
─  using platform: x86_64-w64-mingw32 (64-bit)
─  using session charset: UTF-8
─  using options '--no-manual --as-cran'
✔  checking for file 'tidyaml/DESCRIPTION'
─  this is package 'tidyaml' version '0.0.0.9000'
─  package encoding: UTF-8
✔  checking package namespace information
✔  checking package dependencies (5.2s)
✔  checking if this is a source package ...
✔  checking if there is a namespace
✔  checking for executable files (349ms)
✔  checking for hidden files and directories ...
✔  checking for portable file names
✔  checking serialization versions
✔  checking whether package 'tidyaml' can be installed (3.5s)
✔  checking installed package size ...
✔  checking package directory
✔  checking for future file timestamps ...
✔  checking 'build' directory ...
✔  checking DESCRIPTION meta-information ...
✔  checking top-level files
✔  checking for left-over files ...
✔  checking index information ...
✔  checking package subdirectories ...
✔  checking R files for non-ASCII characters ...
✔  checking R files for syntax errors ...
✔  checking whether the package can be loaded (890ms)
✔  checking whether the package can be loaded with stated dependencies (770ms)
✔  checking whether the package can be unloaded cleanly (773ms)
✔  checking whether the namespace can be loaded with stated dependencies (790ms)
✔  checking whether the namespace can be unloaded cleanly (991ms)
✔  checking loading without being on the library search path (977ms)
✔  checking dependencies in R code (776ms)
✔  checking S3 generic/method consistency (1.2s)
✔  checking replacement functions (768ms)
✔  checking foreign function calls (775ms)
✔  checking R code for possible problems (5.2s)
✔  checking Rd files ...
✔  checking Rd metadata ...
✔  checking Rd line widths ...
✔  checking Rd cross-references ...
✔  checking for missing documentation entries (774ms)
✔  checking for code/documentation mismatches (2.3s)
✔  checking Rd \usage sections (1.4s)
✔  checking Rd contents ...
✔  checking for unstated dependencies in examples ...
✔  checking installed files from 'inst/doc'
✔  checking files in 'vignettes'
E  checking examples (2.2s)
   Running examples in 'tidyaml-Ex.R' failed
   The error most likely occurred in:

   > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
   > ### Name: fast_regression_parsnip_spec_tbl
   > ### Title: Utility Regression call to 'parsnip'
   > ### Aliases: fast_regression_parsnip_spec_tbl
   >
   > ### ** Examples
   >
   > fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
   Error in `dplyr::mutate()`:
   ! Problem while computing `.model_spec = purrr::pmap(dplyr::cur_data(),
     ~match.fun(..3)(mode = ..2, engine = ..1))`.
   Caused by error in `get()`:
   ! object 'linear_reg' of mode 'function' was not found
   Backtrace:
        ▆
     1. ├─tidyaml::fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
     2. │ └─mod_filtered_tbl %>% ...
     3. ├─dplyr::mutate(...)
     4. ├─dplyr:::mutate.data.frame(...)
     5. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), caller_env = caller_env())
     6. │   ├─base::withCallingHandlers(...)
     7. │   └─mask$eval_all_mutate(quo)
     8. ├─purrr::pmap(dplyr::cur_data(), ~match.fun(..3)(mode = ..2, engine = ..1))
     9. │ └─tidyaml (local) .f(...)
    10. │   └─base::match.fun(..3)
    11. │     └─base::get(as.character(FUN), mode = "function", envir = envir)
    12. └─base::.handleSimpleError(...)
    13.   └─dplyr (local) h(simpleError(msg, call))
    14.     └─rlang::abort(...)
   Execution halted
✔  checking for unstated dependencies in vignettes ...
✔  checking package vignettes in 'inst/doc' ...
✔  checking re-building of vignette outputs (1.8s)
✔  checking for non-standard things in the check directory
✔  checking for detritus in the temp directory ...

   See
     'C:/Users/steve/Documents/GitHub/tidyaml.Rcheck/00check.log'
   for details.

── R CMD check results ─────────────────────────────────────────────────────────── tidyaml 0.0.0.9000 ────
Duration: 35.9s

❯ checking examples ... ERROR
  Running examples in 'tidyaml-Ex.R' failed
  The error most likely occurred in:

  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: fast_regression_parsnip_spec_tbl
  > ### Title: Utility Regression call to 'parsnip'
  > ### Aliases: fast_regression_parsnip_spec_tbl
  >
  > ### ** Examples
  >
  > fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
  Error in `dplyr::mutate()`:
  ! Problem while computing `.model_spec = purrr::pmap(dplyr::cur_data(),
    ~match.fun(..3)(mode = ..2, engine = ..1))`.
  Caused by error in `get()`:
  ! object 'linear_reg' of mode 'function' was not found
  Backtrace:
       ▆
    1. ├─tidyaml::fast_regression_parsnip_spec_tbl(.parsnip_fns = "linear_reg")
    2. │ └─mod_filtered_tbl %>% ...
    3. ├─dplyr::mutate(...)
    4. ├─dplyr:::mutate.data.frame(...)
    5. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), caller_env = caller_env())
    6. │   ├─base::withCallingHandlers(...)
    7. │   └─mask$eval_all_mutate(quo)
    8. ├─purrr::pmap(dplyr::cur_data(), ~match.fun(..3)(mode = ..2, engine = ..1))
    9. │ └─tidyaml (local) .f(...)
   10. │   └─base::match.fun(..3)
   11. │     └─base::get(as.character(FUN), mode = "function", envir = envir)
   12. └─base::.handleSimpleError(...)
   13.   └─dplyr (local) h(simpleError(msg, call))
   14.     └─rlang::abort(...)
  Execution halted

1 error ✖ | 0 warnings ✔ | 0 notes ✔
Error: R CMD check found ERRORs
Execution halted

Exited with status 1.

parsn

        #~ get(..3)(mode = ..2, engine = ..1)


问:
iMessage Link Previews
I was wondering how twitter does I message link previews. For example if someone tweets with just text it will preview the text of that tweet, where if they instead tweet an image it will preview the image. What I am trying to figure out is how to preview text rather than the image in cases where I don't have an image on that page.

Anything here helps!!!!

```<code><meta property="og:title" content={props.data.author.username}></meta>
      <meta property="og:image" content="https://books.google.com/books/publisher/content/images/frontcover/hORqzwEACAAJ?fife=w400-h600&source=gbs_api"></meta>
      <img src={`https://books.google.com/books/publisher/content/images/frontcover/${props.data.book.googleBookId}?fife=w400-h600&source=gbs_api`}></img>
</code>```

This is what I am using to load the image preview but would also like to load the text when for instance there is no book cover. Thanks!

Title: iMessage Link Previews

Body:
I was wondering how twitter does I message link previews. For example if someone tweets with just text it will preview the text of that tweet, where if they instead tweet an image it will preview the image. What I am trying to figure out is how to preview text rather than the image in cases where I don't have an image on that page.

Anything here helps!!!!

<meta property="og:title" content={props.data.author.username}></meta>
      <meta property="og:image" content="https://books.google.com/books/publisher/content/images/frontcover/hORqzwEACAAJ?fife=w400-h600&source=gbs_api"></meta>
      <img src={`https://books.google.com/books/publisher/content/images/frontcover/${props.data.book.googleBookId}?fife=w400-h600&source=gbs_api`}>

This is what I am using to load the image preview but would also like to load the text when for instance there is no book cover. Thanks!


问:
How can I execute a file.sh remotely?
I have a small cluster and I have a bash script in a .sh file on a node where I try to run some commands remotely, but it does not working.

When I run the commands individually on the nodes, it works. Even when I connect from the master node via ssh to other nodes, it works. However, when I run the bash script (.sh file) from the master node, it does not work.

For example:

file.sh -> this is only on the master node:

```<code>#!/bin/bash

ssh -t root@192.168.1.45 bash file2.sh

exit
</code>```

(https://i.stack.imgur.com/2M6r5.png)

file2.sh -> this is on the all nodes but the master node:

```<code>#!/bin/bash

if sqlplus -V; then
  echo "OK"
else
  echo "Error"
fi
exit
</code>```

(https://i.stack.imgur.com/jFTCI.png)

Running the bash script (file.sh file) from the master node. I get:

```<code>[cluster_master@localhost ~]$ bash file.sh
root@192.168.1.45's password:
file2.sh: línea 2: sqlplus: no se encontró la orden
Error
Connection to 192.168.1.45 closed.
[cluster_master@localhost ~]$
</code>```

(https://i.stack.imgur.com/zeqTP.png)

Connecting via ssh to a node and run the bash script (file2.sh file) and then the command individually. I get:

```<code>[cluster_master@localhost ~]$ ssh root@192.168.1.45
root@192.168.1.45's password:
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Mon Dec  5 22:51:20 2022 from 192.168.1.32
[root@localhost ~]# bash file2.sh

SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

OK
[root@localhost ~]# sqlplus -V

SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

[root@localhost ~]#
</code>```

(https://i.stack.imgur.com/tNQ3f.png)

Running directly from one node the bash script (file2.sh file) and then the command individually (the same thing happens on the other nodes). I get:

```<code>    [root@localhost ~]# bash file2.sh

    SQL*Plus: Release 19.0.0.0.0 - Production
    Version 19.3.0.0.0

    OK
    [root@localhost ~]# sqlplus -V

    SQL*Plus: Release 19.0.0.0.0 - Production
    Version 19.3.0.0.0

    [root@localhost ~]#
</code>```

(https://i.stack.imgur.com/uI9Zv.png)

Both, file.sh and file2.sh have full permissions.

IP 192.168.1.32 -> The master node

IP 192.168.1.45 -> one of the nodes

I want to run the bash script (file.sh file) from the master node and get the result that I get when I connect via ssh to a node and run the bash script (file2.sh file) and then the command individually or as when I am directly in a node.

It happen with any commands, not just sqlplus.
In the case of sqlplus command, the environment varibles are set up.

Title: How can I execute a file.sh remotely?

Body:
I have a small cluster and I have a bash script in a .sh file on a node where I try to run some commands remotely, but it does not working.

When I run the commands individually on the nodes, it works. Even when I connect from the master node via ssh to other nodes, it works. However, when I run the bash script (.sh file) from the master node, it does not work.

For example:

file.sh -> this is only on the master node:

#!/bin/bash

ssh -t root@192.168.1.45 bash file2.sh

exit

(https://i.stack.imgur.com/2M6r5.png)

file2.sh -> this is on the all nodes but the master node:

#!/bin/bash

if sqlplus -V; then
  echo "OK"
else
  echo "Error"
fi
exit

(https://i.stack.imgur.com/jFTCI.png)

Running the bash script (file.sh file) from the master node. I get:

[cluster_master@localhost ~]$ bash file.sh
root@192.168.1.45's password:
file2.sh: línea 2: sqlplus: no se encontró la orden
Error
Connection to 192.168.1.45 closed.
[cluster_master@localhost ~]$

(https://i.stack.imgur.com/zeqTP.png)

Connecting via ssh to a node and run the bash script (file2.sh file) and then the command individually. I get:

[cluster_master@localhost ~]$ ssh root@192.168.1.45
root@192.168.1.45's password:
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Mon Dec  5 22:51:20 2022 from 192.168.1.32
[root@localhost ~]# bash file2.sh

SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

OK
[root@localhost ~]# sqlplus -V

SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

[root@localhost ~]#

(https://i.stack.imgur.com/tNQ3f.png)

Running directly from one node the bash script (file2.sh file) and then the command individually (the same thing happens on the other nodes). I get:

    [root@localhost ~]# bash file2.sh

    SQL*Plus: Release 19.0.0.0.0 - Production
    Version 19.3.0.0.0

    OK
    [root@localhost ~]# sqlplus -V

    SQL*Plus: Release 19.0.0.0.0 - Production
    Version 19.3.0.0.0

    [root@localhost ~]#

(https://i.stack.imgur.com/uI9Zv.png)

Both, file.sh and file2.sh have full permissions.

IP 192.168.1.32 -> The master node

IP 192.168.1.45 -> one of the nodes

I want to run the bash script (file.sh file) from the master node and get the result that I get when I connect via ssh to a node and run the bash script (file2.sh file) and then the command individually or as when I am directly in a node.

It happen with any commands, not just sqlplus.
In the case of sqlplus command, the environment varibles are set up.


问:
Blazor WASM Site Doesn't Work In Firefox When Served Via Apache
I have a Blazor WASM site that I have created to replace an existing website that I have taken over hosting for. Until the current term is up, I am hosting the site on GoDaddy, which uses Apache.

The site is working great, except for that Blaozr fails to initialize in Firefox when it is being hosted from GoDaddy. Every other browser I have tried works fine without any issues, and Firefox works fine if I use something like dotnet serve to test locally.

The error I get is

Uncaught (in promise) TypeError: NetworkError whe attempting to fetch resource.

The stacktrace is in the image below

After finding this documentation from Microsoft, I tried making some changes to the .htaccess file on the server. It currently looks like this:

```<code>RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?redacted\.com
RewriteRule ^(.*)$ https://www.redacted.com/$1 [R,L]

AddType application/wasm wasm
AddType application/octet-stream dll
AddType application/wasm .wasm
AddType application/octet-stream .dll

<IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/css
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE text/html
        AddOutputFilterByType DEFLATE application/octet-stream
        AddOutputFilterByType DEFLATE application/wasm
        <IfModule mod_setenvif.c>
            BrowserMatch ^Mozilla/4 gzip-only-text/html
            BrowserMatch ^Mozilla/4.0[678] no-gzip
            BrowserMatch bMSIE !no-gzip !gzip-only-text/html
        </IfModule>
</IfModule>
</code>```

I also tried creating a brand-new Blazor WASM project, publishing it, and hosting that. It has the same issue.

I am at a loss for how to troubleshoot this issue further. Does anyone know what may be wrong?

Body:
I have a Blazor WASM site that I have created to replace an existing website that I have taken over hosting for. Until the current term is up, I am hosting the site on GoDaddy, which uses Apache.

The site is working great, except for that Blaozr fails to initialize in Firefox when it is being hosted from GoDaddy. Every other browser I have tried works fine without any issues, and Firefox works fine if I use something like dotnet serve to test locally.

The error I get is

Uncaught (in promise) TypeError: NetworkError whe attempting to fetch resource.

The stacktrace is in the image below

After finding this documentation from Microsoft, I tried making some changes to the .htaccess file on the server. It currently looks like this:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?redacted\.com
RewriteRule ^(.*)$ https://www.redacted.com/$1 [R,L]

AddType application/wasm wasm
AddType application/octet-stream dll
AddType application/wasm .wasm
AddType application/octet-stream .dll

<IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/css
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE text/html
        AddOutputFilterByType DEFLATE application/octet-stream
        AddOutputFilterByType DEFLATE application/wasm
        <IfModule mod_setenvif.c>
            BrowserMatch ^Mozilla/4 gzip-only-text/html
            BrowserMatch ^Mozilla/4.0[678] no-gzip
            BrowserMatch bMSIE !no-gzip !gzip-only-text/html
        </IfModule>
</IfModule>

I also tried creating a brand-new Blazor WASM project, publishing it, and hosting that. It has the same issue.

I am at a loss for how to troubleshoot this issue further. Does anyone know what may be wrong?


问:
How to find structure member memory address from dwarf debug information?
I'm trying to find structure member memory address(Non Virtual Memory, embedded) from dwarf.

And there's two things i don't understand.

First, In below dwarf Info1 DW_AT_location value = [3, 192, 63, 2, 128].

According to dwarf standards, [192, 63, 2, 128] is a address which encoded unsigned LEB128 and little endian.

But when i check this structure variable memory adress using other third party software, memory address is 0x80023fc0.

It means [192, 63, 2, 128] is not encoded unsigned LEB128, but it just little endian decimal.

Please explain why it happens.(i parse dwarf information using python elftools module)

```<code>DIE DW_TAG_variable, size=37, has_children=False
    |DW_AT_name        :  AttributeValue(name='DW_AT_name', form='DW_FORM_string', value=b'apCalVariant_Appl_LCS', raw_value=b'apCalVariant_Appl_LCS', offset=26734224)
    |DW_AT_decl_file   :  AttributeValue(name='DW_AT_decl_file', form='DW_FORM_udata', value=38, raw_value=38, offset=26734246)
    |DW_AT_decl_line   :  AttributeValue(name='DW_AT_decl_line', form='DW_FORM_udata', value=8, raw_value=8, offset=26734247)
    |DW_AT_decl_column :  AttributeValue(name='DW_AT_decl_column', form='DW_FORM_udata', value=24, raw_value=24, offset=26734248)
    |DW_AT_type        :  AttributeValue(name='DW_AT_type', form='DW_FORM_ref_addr', value=6023079, raw_value=6023079, offset=26734249)
    |DW_AT_external    :  AttributeValue(name='DW_AT_external', form='DW_FORM_flag', value=True, raw_value=1, offset=26734253)
    |DW_AT_location    :  AttributeValue(name='DW_AT_location', form='DW_FORM_block', value=[3, 192, 63, 2, 128], raw_value=[3, 192, 63, 2, 128], offset=26734254)
</code>```

Second, In below dwarf Information there are two structure members with DW_AT_data_member_location = [35, 196, 1], [35, 144, 2].

This structure members is member of first question structure variable.
(1) k_u16_LCS_VarStrTq_1En2Nm(address : 0x80024084), (2) k_s16_LCS_LacDeActvLatestCtrlLine_LCHold_1En3m(address : 0x800240D0).

I don't understand what DW_AT_data_member_location value is stands for.

k_u16_LCS_VarStrTq_1En2Nm address is structure start address(0x80023fc0) + 196(0xC4).

But k_s16_LCS_LacDeActvLatestCtrlLine_LCHold_1En3m address is not structure start address(0x80023fc0) + 144(0x90) = 0x80024050.

```<code>DIE DW_TAG_member, size=36, has_children=False
    |DW_AT_name        :  AttributeValue(name='DW_AT_name', form='DW_FORM_string', value=b'k_u16_LCS_VarStrTq_1En2Nm', raw_value=b'k_u16_LCS_VarStrTq_1En2Nm', offset=5215310)
    |DW_AT_type        :  AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=312, raw_value=312, offset=5215336)
    |DW_AT_byte_size   :  AttributeValue(name='DW_AT_byte_size', form='DW_FORM_udata', value=2, raw_value=2, offset=5215340)
    |DW_AT_data_member_location:  AttributeValue(name='DW_AT_data_member_location', form='DW_FORM_block', value=[35, 196, 1], raw_value=[35, 196, 1], offset=5215341)
</code>```
```<code>DIE DW_TAG_member, size=57, has_children=False
    |DW_AT_name        :  AttributeValue(name='DW_AT_name', form='DW_FORM_string', value=b'k_s16_LCS_LacDeActvLatestCtrlLine_LCHold_1En3m', raw_value=b'k_s16_LCS_LacDeActvLatestCtrlLine_LCHold_1En3m', offset=5216696)
    |DW_AT_type        :  AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=283, raw_value=283, offset=5216743)
    |DW_AT_byte_size   :  AttributeValue(name='DW_AT_byte_size', form='DW_FORM_udata', value=2, raw_value=2, offset=5216747)
    |DW_AT_data_member_location:  AttributeValue(name='DW_AT_data_member_location', form='DW_FORM_block', value=[35, 144, 2], raw_value=[35, 144, 2], offset=5216748)
</code>```

Please explain what DW_AT_data_member_location means and how can i calculate structure member addresss using it.

In advanced, Thank you for all you guys.

Body:
I'm trying to find structure member memory address(Non Virtual Memory, embedded) from dwarf.

And there's two things i don't understand.

First, In below dwarf Info1 DW_AT_location value = [3, 192, 63, 2, 128].

According to dwarf standards, [192, 63, 2, 128] is a address which encoded unsigned LEB128 and little endian.

But when i check this structure variable memory adress using other third party software, memory address is 0x80023fc0.

It means [192, 63, 2, 128] is not encoded unsigned LEB128, but it just little endian decimal.

Please explain why it happens.(i parse dwarf information using python elftools module)

DIE DW_TAG_variable, size=37, has_children=False
    |DW_AT_name        :  AttributeValue(name='DW_AT_name', form='DW_FORM_string', value=b'apCalVariant_Appl_LCS', raw_value=b'apCalVariant_Appl_LCS', offset=26734224)
    |DW_AT_decl_file   :  AttributeValue(name='DW_AT_decl_file', form='DW_FORM_udata', value=38, raw_value=38, offset=26734246)
    |DW_AT_decl_line   :  AttributeValue(name='DW_AT_decl_line', form='DW_FORM_udata', value=8, raw_value=8, offset=26734247)
    |DW_AT_decl_column :  AttributeValue(name='DW_AT_decl_column', form='DW_FORM_udata', value=24, raw_value=24, offset=26734248)
    |DW_AT_type        :  AttributeValue(name='DW_AT_type', form='DW_FORM_ref_addr', value=6023079, raw_value=6023079, offset=26734249)
    |DW_AT_external    :  AttributeValue(name='DW_AT_external', form='DW_FORM_flag', value=True, raw_value=1, offset=26734253)
    |DW_AT_location    :  AttributeValue(name='DW_AT_location', form='DW_FORM_block', value=[3, 192, 63, 2, 128], raw_value=[3, 192, 63, 2, 128], offset=26734254)

Second, In below dwarf Information there are two structure members with DW_AT_data_member_location = [35, 196, 1], [35, 144, 2].

This structure members is member of first question structure variable.
(1) k_u16_LCS_VarStrTq_1En2Nm(address : 0x80024084), (2) k_s16_LCS_LacDeActvLatestCtrlLine_LCHold_1En3m(address : 0x800240D0).

I don't understand what DW_AT_data_member_location value is stands for.

k_u16_LCS_VarStrTq_1En2Nm address is structure start address(0x80023fc0) + 196(0xC4).

But k_s16_LCS_LacDeActvLatestCtrlLine_LCHold_1En3m address is not structure start address(0x80023fc0) + 144(0x90) = 0x80024050.

DIE DW_TAG_member, size=36, has_children=False
    |DW_AT_name        :  AttributeValue(name='DW_AT_name', form='DW_FORM_string', value=b'k_u16_LCS_VarStrTq_1En2Nm', raw_value=b'k_u16_LCS_VarStrTq_1En2Nm', offset=5215310)
    |DW_AT_type        :  AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=312, raw_value=312, offset=5215336)
    |DW_AT_byte_size   :  AttributeValue(name='DW_AT_byte_size', form='DW_FORM_udata', value=2, raw_value=2, offset=5215340)
    |DW_AT_data_member_location:  AttributeValue(name='DW_AT_data_member_location', form='DW_FORM_block', value=[35, 196, 1], raw_value=[35, 196, 1], offset=5215341)

DIE DW_TAG_member, size=57, has_children=False
    |DW_AT_name        :  AttributeValue(name='DW_AT_name', form='DW_FORM_string', value=b'k_s16_LCS_LacDeActvLatestCtrlLine_LCHold_1En3m', raw_value=b'k_s16_LCS_LacDeActvLatestCtrlLine_LCHold_1En3m', offset=5216696)
    |DW_AT_type        :  AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=283, raw_value=283, offset=5216743)
    |DW_AT_byte_size   :  AttributeValue(name='DW_AT_byte_size', form='DW_FORM_udata', value=2, raw_value=2, offset=5216747)
    |DW_AT_data_member_location:  AttributeValue(name='DW_AT_data_member_location', form='DW_FORM_block', value=[35, 144, 2], raw_value=[35, 144, 2], offset=5216748)

Please explain what DW_AT_data_member_location means and how can i calculate structure member addresss using it.

In advanced, Thank you for all you guys.


问:
Forte CSG Creating Hash Signature
I am probably well over my head, but trying to build a hopefully simple check out button using CSG Forte.

I am running into an issue where it notes that

This is the sample code from the dev doc that is provided for checkout button.

I have the API_Access_ID generated.

but cannot figure out how to generate Signature.

```<code>
<!DOCTYPE html>
    <script type="text/javascript" src="https://sandbox.forte.net/checkout/v2/js"></script>
    <button api_access_id="apiaccessid"
        method="sale"
        version_number="2.0"
        location_id="115161"
        utc_time="UTCtime"
        order_number="ASX458956"
        signature="sha256signature">
        Pay Now</button>

</code>```

Dev doc notes

```<code>
The example below displays what information your signature should contain:

HMACSHA256("api_access_id|method|version_number|total_amount|utc_time|order_number|customer_token|paymethod_token",
"API Secure Key")

</code>```

Quick questions,

-How are you supposed to generate the signature?
-Is there anything else I need to generate to run this code?

Thank you for indulging me on this noob question.

Tried running signature as is. (example provided)

Gave me an error "This api_login_id does not have permission to access the requested location."

Title: Forte CSG Creating Hash Signature

Body:
I am probably well over my head, but trying to build a hopefully simple check out button using CSG Forte.

I am running into an issue where it notes that

This is the sample code from the dev doc that is provided for checkout button.

I have the API_Access_ID generated.

but cannot figure out how to generate Signature.

<!DOCTYPE html>

    <button api_access_id="apiaccessid"
        method="sale"
        version_number="2.0"
        location_id="115161"
        utc_time="UTCtime"
        order_number="ASX458956"
        signature="sha256signature">
        Pay Now</button>

Dev doc notes

The example below displays what information your signature should contain:

HMACSHA256("api_access_id|method|version_number|total_amount|utc_time|order_number|customer_token|paymethod_token",
"API Secure Key")

Quick questions,

-How are you supposed to generate the signature?
-Is there anything else I need to generate to run this code?

Thank you for indulging me on this noob question.

Tried running signature as is. (example provided)

Gave me an error "This api_login_id does not have permission to access the requested location."


问:
Best way to distinguish between Telegram group and channel with gramJS
GramJS https://gram.js.org/ is the good nodejs library for interact with Telegram.

My question is
Is there any way to know which one is group, which one is channel when input is just telegram link (ex: t.me/name)

Thank you folks.


问:
debug they have same value but still get index out of range
When I debug my code, the value of the variables shows that they are equal to my limit condition but my while loop still works

I'm trying to stop my while loop by this limitation:

```<code>while (i + j) != len(fruits):
</code>```

Even though (i+j) is equal to len(fruits), the loop still works, it doesn't break.
It should be broken when it meets my limitation.
My code is below:

```<code>from typing import List
class Solution:
    def totalFruit(self, fruits: List[int]) -> int:
        pointed = [0 for i in range(max(fruits) + 1)]
        maX, count = 0, 0
        count_type = 0
        i, j = 0, 0
        while (i + j) != len(fruits):
            while count_type < 3:
                if pointed[fruits[i + j]] == 0:
                    count_type += 1
                    if count_type < 3:
                        count += 1
                        pointed[fruits[i + j]] += 1
                        j += 1

                elif count_type < 3 and pointed[fruits[i + j]] != 0:
                    pointed[fruits[i + j]] += 1
                    count += 1
                    j += 1

                if count > maX: maX = count

            if pointed[fruits[i]] == 1: count_type -= 2

            pointed[fruits[i]] -= 1
            count -= 1
            i += 1
            j-= 1

        return maX

fruits = input()
fruits = [int(i) for i in fruits.split()]
obj = Solution()
print(obj.totalFruit(fruits))
</code>```

when I debug:
enter image description here

Body:
When I debug my code, the value of the variables shows that they are equal to my limit condition but my while loop still works

I'm trying to stop my while loop by this limitation:

while (i + j) != len(fruits):

Even though (i+j) is equal to len(fruits), the loop still works, it doesn't break.
It should be broken when it meets my limitation.
My code is below:

from typing import List
class Solution:
    def totalFruit(self, fruits: List[int]) -> int:
        pointed = [0 for i in range(max(fruits) + 1)]
        maX, count = 0, 0
        count_type = 0
        i, j = 0, 0
        while (i + j) != len(fruits):
            while count_type < 3:
                if pointed[fruits[i + j]] == 0:
                    count_type += 1
                    if count_type < 3:
                        count += 1
                        pointed[fruits[i + j]] += 1
                        j += 1

                elif count_type < 3 and pointed[fruits[i + j]] != 0:
                    pointed[fruits[i + j]] += 1
                    count += 1
                    j += 1

                if count > maX: maX = count

            if pointed[fruits[i]] == 1: count_type -= 2

            pointed[fruits[i]] -= 1
            count -= 1
            i += 1
            j-= 1

        return maX

fruits = input()
fruits = [int(i) for i in fruits.split()]
obj = Solution()
print(obj.totalFruit(fruits))

when I debug:
enter image description here


问:
Many to many relationship on Neo4j
Am newer in Neo4j and have some difficults to represent complex relationships (many to many relations), please see the two linked images below (Class diagram and its relationnal schema).

class diagram.

relationnal schema

As I've shown from the images, I would like to represent on Neo4j the green relationship (Consultation one).

Could you help me please !!!

Title: Many to many relationship on Neo4j


问:
Is there a way to sync "Recent" (remote) workspaces across devices?
I have a couple of different computers that I essentially use as thin-clients that remotely connect to a bigger, beefier machine where all my development is actually done. As a result I'm constantly accessing the same remote projects, repeatedly, on a bunch of different computers.

Is there a way to have the "Recent" list (on the Get Started pane) sync between devices, so if I access a remote repository on one device, it becomes the most "Recent" workspace when I open VS Code on another device?


问:
How do I get a specific key in a nested map in terraform, when running in a for_each/for loop?
I have two sets of locals defined as below:

```<code>locals {
  env1 = {
    a = {
    }
    b = {
    }
  }
}

locals {
  env2 = {
    x = {
    }

    y = {
    }
  }
}
</code>```

Now, I have to run a loop for local.env1 so that loop runs for a & b. But I also need "x" from local.env2 for a resource attribute in the same resource block the loops runs.

There are 2 resource blocks and it would look something like this:

```<code>resource_block1
{
 for_each     = local.env1
 scope        = each.key
 id           = something["x"]
}

resource_block2
{
 for_each     = local.env1
 scope        = each.key
 id           = something["y"]
}

</code>```

For "id" attribute in both the resource blocks I don't want to hardcode "x" or "y" respectively. I want to programmatically fill "x" and "y" for "id" attribute in the respective resource blocks.

I tried to create a map for env1 and env2 I was able to fetch "a" and "b" from local.env1 but I am unable to fetch/filter only "x" or only "y" from it.

Any ideas/solutions please? Thank you for checking.

Body:
I have two sets of locals defined as below:

locals {
  env1 = {
    a = {
    }
    b = {
    }
  }
}

locals {
  env2 = {
    x = {
    }

    y = {
    }
  }
}

Now, I have to run a loop for local.env1 so that loop runs for a & b. But I also need "x" from local.env2 for a resource attribute in the same resource block the loops runs.

There are 2 resource blocks and it would look something like this:

resource_block1
{
 for_each     = local.env1
 scope        = each.key
 id           = something["x"]
}

resource_block2
{
 for_each     = local.env1
 scope        = each.key
 id           = something["y"]
}

For "id" attribute in both the resource blocks I don't want to hardcode "x" or "y" respectively. I want to programmatically fill "x" and "y" for "id" attribute in the respective resource blocks.

I tried to create a map for env1 and env2 I was able to fetch "a" and "b" from local.env1 but I am unable to fetch/filter only "x" or only "y" from it.

Any ideas/solutions please? Thank you for checking.


问:
How can I test a rest API locally for a Google Add On, using python
I am trying to develop a Google Add On for gmail. I want the backend to be built in python.

My problem is that every-time I need to test the Add On I must redeploy my files and build into the cloud. I would like to test locally so that I can more rapidly develop my application.

Any help is much appreciated. Thank you.

I want to be able to see the content of the JSON and other information sent from gmail.


问:
Detectron2 - How to use RepeatFactorTrainingSampler in class imbalance problem
I'm facing class imbalance problem in a 2 classes classification problem.

Generally class 1 is about 25% of class 2. (class 1= 100 observations, class 2 = 400)

So i will need class 1 to have 4x times more than the current observation.

With the current setting:

```<code>cfg.DATALOADER.SAMPLER_TRAIN = "RepeatFactorTrainingSampler"
cfg.DATALOADER.REPEAT_THRESHOLD = 2
</code>```

cfg.DATALOADER.REPEAT_THRESHOLD is a threshold for both classes? How can i increase the sample for class 1 only?

Thank you.

Body:
I'm facing class imbalance problem in a 2 classes classification problem.

Generally class 1 is about 25% of class 2. (class 1= 100 observations, class 2 = 400)

So i will need class 1 to have 4x times more than the current observation.

With the current setting:

cfg.DATALOADER.SAMPLER_TRAIN = "RepeatFactorTrainingSampler"
cfg.DATALOADER.REPEAT_THRESHOLD = 2

cfg.DATALOADER.REPEAT_THRESHOLD is a threshold for both classes? How can i increase the sample for class 1 only?

Thank you.


问:
How Do I Fix This Data Frame Error for this dataset on Covid?
read.csv('covid_deaths.csv', header = TRUE)
df <-covid_deaths

covid_deaths$Age Group <- factor(covid_deaths$Age Group, levels = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), labels = c('All Ages', 'Under One Year', '0-17 years', '1-4 years', '5-14 years', '15-24 years', '18-29 years', '25-34 years', '30-39 years', '35-44 years', '40-49 years', '45-54 years', '50-64 years', '55-64 years', '65-74 years', '75-84 years', '85 years and older'))

#increasing the max.print limit to see more on console
options(max.print = 60)

#pulling up the age group and COVID_19 deaths
covid_deaths[, c('Age Group','COVID_19 Deaths')]

#making a vector out of the relevant columns

df2[,c( 9,10)]
vec1 <- covid_deaths$Age Group
vec2 <- covid_deaths$COVID_19 Deaths
summary(covid_deaths)

m <- covid_deaths(matrix(sample(100, 20, replace = TRUE), ncol = 9))

I am trying to get the descriptive statisitics mean, standard deviation and variance. I keep on getting an error that

```<code>Error in `$<-.data.frame`(`*tmp*`, `Age Group`, value = integer(0)) :
  replacement has 0 rows, data has 107406
</code>```

Body:
read.csv('covid_deaths.csv', header = TRUE)
df <-covid_deaths

covid_deaths$Age Group <- factor(covid_deaths$Age Group, levels = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), labels = c('All Ages', 'Under One Year', '0-17 years', '1-4 years', '5-14 years', '15-24 years', '18-29 years', '25-34 years', '30-39 years', '35-44 years', '40-49 years', '45-54 years', '50-64 years', '55-64 years', '65-74 years', '75-84 years', '85 years and older'))

#increasing the max.print limit to see more on console
options(max.print = 60)

#pulling up the age group and COVID_19 deaths
covid_deaths[, c('Age Group','COVID_19 Deaths')]

#making a vector out of the relevant columns

df2[,c( 9,10)]
vec1 <- covid_deaths$Age Group
vec2 <- covid_deaths$COVID_19 Deaths
summary(covid_deaths)

m <- covid_deaths(matrix(sample(100, 20, replace = TRUE), ncol = 9))

I am trying to get the descriptive statisitics mean, standard deviation and variance. I keep on getting an error that

Error in `$<-.data.frame`(`*tmp*`, `Age Group`, value = integer(0)) :
  replacement has 0 rows, data has 107406


问:
Can anyone tell me that the error "calling xxxx on bad self" shows
I use lua in Unity. When I call the function **TryDisableHeadWear **, there are some error I can't understand.
calling 'GetSurfaceName' on bad self (string expected, got nil)

```<code>function def:TryDisableHeadWear()
    if not self:CheckSurfaceName(self._hat_go) then
        self._hat_go:SetActive(false)
    end
end

function def:CheckSurfaceName(obj)
    local surface_name     = self:GetSurfaceName(obj)
    return head_wear_surface[surface_name] ~= nil
end

local reg = "(%w+)"
function def:GetSurfaceName(obj)
    if not obj then return end
    local root_obj   = self:GetSurfaceObj(obj)
    local surface_obj_name = root_obj and root_obj.name
    return surface_obj_name and string.match(surface_obj_name, reg)
end

function def:GetSurfaceObj(obj)
    if string.find(obj.name, "Surface") then
        return obj
    else
        local parent = obj.transform.parent
        if not parent then return end
        return self:GetSurfaceObj(parent.gameObject)
    end
end
</code>```

Can anyone tell me what the error means?

I try to call the function in normal environment. I get no error and everything goes well. But where are some error report in firebase that means the code above has bugs

Body:
I use lua in Unity. When I call the function **TryDisableHeadWear **, there are some error I can't understand.
calling 'GetSurfaceName' on bad self (string expected, got nil)

function def:TryDisableHeadWear()
    if not self:CheckSurfaceName(self._hat_go) then
        self._hat_go:SetActive(false)
    end
end

function def:CheckSurfaceName(obj)
    local surface_name     = self:GetSurfaceName(obj)
    return head_wear_surface[surface_name] ~= nil
end

local reg = "(%w+)"
function def:GetSurfaceName(obj)
    if not obj then return end
    local root_obj   = self:GetSurfaceObj(obj)
    local surface_obj_name = root_obj and root_obj.name
    return surface_obj_name and string.match(surface_obj_name, reg)
end

function def:GetSurfaceObj(obj)
    if string.find(obj.name, "Surface") then
        return obj
    else
        local parent = obj.transform.parent
        if not parent then return end
        return self:GetSurfaceObj(parent.gameObject)
    end
end

Can anyone tell me what the error means?

I try to call the function in normal environment. I get no error and everything goes well. But where are some error report in firebase that means the code above has bugs


问:
windows.h setpixel isnt working in project
I am writing some code to get acquainted with the windows API. I was able to get a window to open but when I tried to write a program to draw random pixels. I am using GCC with Vscode. here is the code:

```<code>#include <windows.h>
#include <time.h>

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
void DrawPixels(HWND hwnd);

int WINAPI
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int nShowCmd) {

    MSG  msg;
    WNDCLASSW wc = {0};

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpszClassName = L"Pixels";
    wc.hInstance     = hInstance;
    wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
    wc.lpfnWndProc   = WndProc;
    wc.hCursor       = LoadCursor(0, IDC_ARROW);

    RegisterClassW(&wc);
    CreateWindowW(wc.lpszClassName, L"Pixels",
                WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                100, 100, 300, 250, NULL, NULL, hInstance, NULL);

    while (GetMessage(&msg, NULL, 0, 0)) {

        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    srand(time(NULL));

    return (int) msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
    WPARAM wParam, LPARAM lParam) {

    switch(msg) {

        case WM_PAINT:

            DrawPixels(hwnd);
            break;

        case WM_DESTROY:

            PostQuitMessage(0);
            return 0;
    }

    return DefWindowProcW(hwnd, msg, wParam, lParam);
}

void DrawPixels(HWND hwnd) {

    PAINTSTRUCT ps;
    RECT r;

    GetClientRect(hwnd, &r);

    if (r.bottom == 0) {

        return;
    }

    HDC hdc = BeginPaint(hwnd, &ps);

    for (int i=0; i<1000; i++) {

        int x = rand() % r.right;
        int y = rand() % r.bottom;
        SetPixel(hdc, x, y, RGB(255, 0, 0));
    }

    EndPaint(hwnd, &ps);
}
</code>```

Whenever I try to compile this I get the error main.o:main.cpp:(.text+0x224): undefined reference to `SetPixel@16'

I have tried changing the variables and the types but it isnt working.

Body:
I am writing some code to get acquainted with the windows API. I was able to get a window to open but when I tried to write a program to draw random pixels. I am using GCC with Vscode. here is the code:

#include <windows.h>
#include <time.h>

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
void DrawPixels(HWND hwnd);

int WINAPI
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int nShowCmd) {

    MSG  msg;
    WNDCLASSW wc = {0};

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpszClassName = L"Pixels";
    wc.hInstance     = hInstance;
    wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
    wc.lpfnWndProc   = WndProc;
    wc.hCursor       = LoadCursor(0, IDC_ARROW);

    RegisterClassW(&wc);
    CreateWindowW(wc.lpszClassName, L"Pixels",
                WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                100, 100, 300, 250, NULL, NULL, hInstance, NULL);

    while (GetMessage(&msg, NULL, 0, 0)) {

        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    srand(time(NULL));

    return (int) msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
    WPARAM wParam, LPARAM lParam) {

    switch(msg) {

        case WM_PAINT:

            DrawPixels(hwnd);
            break;

        case WM_DESTROY:

            PostQuitMessage(0);
            return 0;
    }

    return DefWindowProcW(hwnd, msg, wParam, lParam);
}

void DrawPixels(HWND hwnd) {

    PAINTSTRUCT ps;
    RECT r;

    GetClientRect(hwnd, &r);

    if (r.bottom == 0) {

        return;
    }

    HDC hdc = BeginPaint(hwnd, &ps);

    for (int i=0; i<1000; i++) {

        int x = rand() % r.right;
        int y = rand() % r.bottom;
        SetPixel(hdc, x, y, RGB(255, 0, 0));
    }

    EndPaint(hwnd, &ps);
}

Whenever I try to compile this I get the error main.o:main.cpp:(.text+0x224): undefined reference to `SetPixel@16'

I have tried changing the variables and the types but it isnt working.


问:
asp.net membership provider fails on changepassword when passwordformat moved from clear to hash
I have an old application using asp.net membership for logins (upgraded to .netframework4.8). I have successfully enabled passwordformat from clear to hashed for a new user.
Now there is a need to redirect existing users to changepassword page where they can successfully upgrade their passwords.

I assumed it would work as expected but somehow I get

Also, it does not hit the buttonclick event in debugger so I assume its some inbuilt function from the MembershipUser/Membership.Provider class

```<code>Protected Sub ChangePassword_Click(sender As Object, e As EventArgs) Handles ChangePassword.Click
    Dim msg As String = "Password changed OK"

    Try
        Dim username As String = Request.QueryString("user")
        Dim password As String = NewPassword.Text
        If Trim(password) <> "" Then
            Dim mu As MembershipUser = Membership.Providers("VLSqlMembershipProvider").GetUser(username, False)
            Dim resetPassword As String = mu.ResetPassword()
            mu.ChangePassword(resetPassword, password)
        Else
            Exit Sub
        End If
    Catch ex As Exception
        'msg = ex.Message
        msg = "Password does not meet minimum requirements - min 8 characters"

    End Try

    StatusMessage.Text = msg
End Sub
</code>```

PS: I have changed newpassword length from 7 to 8

Body:
I have an old application using asp.net membership for logins (upgraded to .netframework4.8). I have successfully enabled passwordformat from clear to hashed for a new user.
Now there is a need to redirect existing users to changepassword page where they can successfully upgrade their passwords.

I assumed it would work as expected but somehow I get

Also, it does not hit the buttonclick event in debugger so I assume its some inbuilt function from the MembershipUser/Membership.Provider class

Protected Sub ChangePassword_Click(sender As Object, e As EventArgs) Handles ChangePassword.Click
    Dim msg As String = "Password changed OK"

    Try
        Dim username As String = Request.QueryString("user")
        Dim password As String = NewPassword.Text
        If Trim(password) <> "" Then
            Dim mu As MembershipUser = Membership.Providers("VLSqlMembershipProvider").GetUser(username, False)
            Dim resetPassword As String = mu.ResetPassword()
            mu.ChangePassword(resetPassword, password)
        Else
            Exit Sub
        End If
    Catch ex As Exception
        'msg = ex.Message
        msg = "Password does not meet minimum requirements - min 8 characters"

    End Try

    StatusMessage.Text = msg
End Sub

PS: I have changed newpassword length from 7 to 8


问:
How to set taskmgr process as default realtime?
As described in title. I would like taskmgr.exe to be run as realtime process. I would like it to be called when Ctrl+Alt+Esc to behaviour like that to terminate a buggy program when it ates all the system memroy and starting to swaping between hardisk. It will freeze the system and I would like to kill that by using this way.

By calling from cmd is an approch, but I cannot do that using the shortcut when system start to get freezing.


问:
Redissearch Search with results that prioritize one (or more) field over others
I have created a Schema with 2 fields with different weights
`

```<code> .addTextField("title", 10.0)
 .addTextField("description", 2.0)
</code>```

I pushed 2 objects with the following values:

Object 1:

```<code> fields.put("title", "i want to learn more about coding");
 fields.put("description", "i love redis search");
</code>```

Object 2:

```<code>fields.put("title", "i want to learn more about redis");
fields.put("description", "i love coding coding coding");
</code>```

Now, when I search for the word "coding", object 2 will have a higher score than object 1. because the word "coding" appears 3 times in the description (i guess).

How does object 1 have a higher score than object 2 in search results?
Because I want to prioritize the results in the "title" field over "description".

Best regards!

Body:
I have created a Schema with 2 fields with different weights
`

 .addTextField("title", 10.0)
 .addTextField("description", 2.0)

I pushed 2 objects with the following values:

Object 1:

 fields.put("title", "i want to learn more about coding");
 fields.put("description", "i love redis search");

Object 2:

fields.put("title", "i want to learn more about redis");
fields.put("description", "i love coding coding coding");

Now, when I search for the word "coding", object 2 will have a higher score than object 1. because the word "coding" appears 3 times in the description (i guess).

How does object 1 have a higher score than object 2 in search results?
Because I want to prioritize the results in the "title" field over "description".

Best regards!


问:
python redshift delete statement not working
I am trying to execute the following Redshift SQL in a Python script, but records are not being deleted. There is no error, either.

sql_del = "DELETE FROM table_name where id in (select id from table2)"
cursor.execute(sql_del)
conn.commit()
```


问:
VSCode python debugging quits on Mac with isort error
I was working along in Python in Visual Studio code 1.73.1 on my Mac (OS 11.6, Python 3.9), and after successfully starting a debug session more than 30 times, suddenly it wouldn't. I tried several times. Shortly I noticed this message:  "the isort server has crashed 3 times in 5 minutes. It will not be restarted."  Clicking through, I discovered the existence of the isort extension and began trying solutions:

Turn off the isort extension. Result: the little horizontal progress line in the upper left corner moves for about half a second and then vanishes. No command appears in the terminal. The same result follows the next several steps:

Delete the extension.

Replace it with a competing isort from someone else.

Replace the Python extension with a more trusted version as described here:
https://learn.microsoft.com/en-us/answers/questions/724858/vscode-debugger-not-working-for-python.html

Uninstall and re-download Visual Studio code.

At last I really went all the way:
Trash the application and empty the trash.
Delete all relevant files as listed here [https://stackoverflow.com/questions/42603103/how-to-completely-uninstall-vs-code-on-mac] :

```<code>rm -fr ~/Library/Preferences/com.microsoft.VSCode.helper.plist
rm -fr ~/Library/Preferences/com.microsoft.VSCode.plist
rm -fr ~/Library/Caches/com.microsoft.VSCode
rm -fr ~/Library/Caches/com.microsoft.VSCode.ShipIt/
rm -fr ~/Library/Application\ Support/Code/
rm -fr ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/
rm -fr ~/.vscode/
</code>```

Reinstall Visual Studio code. This got me back to the place where, while failing to start a debug session, it said "the isort server has crashed 3 times in 5 minutes. It will not be restarted."  (How do you clear that flag so that it will try again, anyway?)

It would seem that VSCode debugging has been wrecked by an automatic update to something else that is not actually part of VSCode. Has anyone seen this? Is this a known problem that could be fixed by installing a different version of something?

Logs that may be related to the isort problem:

tail of 1-Python.log:

/usr/lib/python2.7 ~/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/interpreterInfo.py
[ERROR 2022-11-2 10:16:36.608]: [Error: Command failed: /usr/lib/python2.7 /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/get_output_via_markers.py /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/interpreterInfo.py
/bin/sh: /usr/lib/python2.7: is a directory

```<code> at ChildProcess.exithandler (node:child_process:408:12)
 at ChildProcess.emit (node:events:526:28)
 at maybeClose (node:internal/child_process:1092:16)
 at ChildProcess._handle.onexit (node:internal/child_process:302:5)] {
</code>```

killed: false,
code: 126,
signal: null,
cmd: '/usr/lib/python2.7 /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/get_output_via_markers.py /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/interpreterInfo.py'
}
Starting Pylance language server.

tail of 4-isort.log (this block of text repeated several times):

Traceback (most recent call last):
File "/Users/ken/.vscode/extensions/ms-python.isort-2022.8.0/bundled/tool/server.py", line 744, in
LSP_SERVER.start_io()
File "/Users/ken/.vscode/extensions/ms-python.isort-2022.8.0/bundled/libs/pygls/server.py", line 226, in start_io
self.loop.run_until_complete(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Users/ken/.vscode/extensions/ms-python.isort-2022.8.0/bundled/libs/pygls/server.py", line 57, in aio_readline
header = await loop.run_in_executor(executor, rfile.readline)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 814, in run_in_executor
executor.submit(func, *args), loop=self)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 170, in submit
self._adjust_thread_count()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 193, in _adjust_thread_count
t.start()
TypeError: start() missing 1 required positional argument: 'sessionID'
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Error - 10:10:30 AM] Connection to server got closed. Server will not be restarted.

Body:
I was working along in Python in Visual Studio code 1.73.1 on my Mac (OS 11.6, Python 3.9), and after successfully starting a debug session more than 30 times, suddenly it wouldn't. I tried several times. Shortly I noticed this message:  "the isort server has crashed 3 times in 5 minutes. It will not be restarted."  Clicking through, I discovered the existence of the isort extension and began trying solutions:

Turn off the isort extension. Result: the little horizontal progress line in the upper left corner moves for about half a second and then vanishes. No command appears in the terminal. The same result follows the next several steps:

Delete the extension.

Replace it with a competing isort from someone else.

Replace the Python extension with a more trusted version as described here:
https://learn.microsoft.com/en-us/answers/questions/724858/vscode-debugger-not-working-for-python.html

Uninstall and re-download Visual Studio code.

At last I really went all the way:
Trash the application and empty the trash.
Delete all relevant files as listed here [https://stackoverflow.com/questions/42603103/how-to-completely-uninstall-vs-code-on-mac] :

rm -fr ~/Library/Preferences/com.microsoft.VSCode.helper.plist
rm -fr ~/Library/Preferences/com.microsoft.VSCode.plist
rm -fr ~/Library/Caches/com.microsoft.VSCode
rm -fr ~/Library/Caches/com.microsoft.VSCode.ShipIt/
rm -fr ~/Library/Application\ Support/Code/
rm -fr ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/
rm -fr ~/.vscode/

Reinstall Visual Studio code. This got me back to the place where, while failing to start a debug session, it said "the isort server has crashed 3 times in 5 minutes. It will not be restarted."  (How do you clear that flag so that it will try again, anyway?)

It would seem that VSCode debugging has been wrecked by an automatic update to something else that is not actually part of VSCode. Has anyone seen this? Is this a known problem that could be fixed by installing a different version of something?

Logs that may be related to the isort problem:

tail of 1-Python.log:

/usr/lib/python2.7 ~/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/interpreterInfo.py
[ERROR 2022-11-2 10:16:36.608]: [Error: Command failed: /usr/lib/python2.7 /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/get_output_via_markers.py /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/interpreterInfo.py
/bin/sh: /usr/lib/python2.7: is a directory

 at ChildProcess.exithandler (node:child_process:408:12)
 at ChildProcess.emit (node:events:526:28)
 at maybeClose (node:internal/child_process:1092:16)
 at ChildProcess._handle.onexit (node:internal/child_process:302:5)] {

killed: false,
code: 126,
signal: null,
cmd: '/usr/lib/python2.7 /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/get_output_via_markers.py /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/interpreterInfo.py'
}
Starting Pylance language server.

tail of 4-isort.log (this block of text repeated several times):

Traceback (most recent call last):
File "/Users/ken/.vscode/extensions/ms-python.isort-2022.8.0/bundled/tool/server.py", line 744, in
LSP_SERVER.start_io()
File "/Users/ken/.vscode/extensions/ms-python.isort-2022.8.0/bundled/libs/pygls/server.py", line 226, in start_io
self.loop.run_until_complete(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Users/ken/.vscode/extensions/ms-python.isort-2022.8.0/bundled/libs/pygls/server.py", line 57, in aio_readline
header = await loop.run_in_executor(executor, rfile.readline)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 814, in run_in_executor
executor.submit(func, *args), loop=self)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 170, in submit
self._adjust_thread_count()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 193, in _adjust_thread_count
t.start()
TypeError: start() missing 1 required positional argument: 'sessionID'
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Error - 10:10:30 AM] Connection to server got closed. Server will not be restarted.


问:
Rest API - GET request help - Need help in constructing a URI with parameters
I am new to constructing Rest API GET queries.

Need help in GET request of Rest API by passing the fields in sysparm_fields.

I trying to query a Table via Rest API URI by passing only a limited number of columns of the table using Sysparam_fields.

However few column names have Spaces and parenthesis in it. So the JSON result set is excluding those columns and respective data when I do a GET request.

So if I am querying with column names  "assigned_to (need the empid)" and  "Number", I only get "Number" data.

If I dont pass, sysparm_fields it is returning the result set with all the columns including "assigned_to (need the empid)"

My end point looks like this

https://MyInstance.service-now.com/api/now/table/ticket?sysparm_exclude_reference_link=true&sysparm_fields=number,assigned_to (need the empid)&sysparm_query=sys_updated_onBETWEENjavascript:gs.dateGenerate('2020-09-01','00:00:00')@javascript:gs.dateGenerate('2020-09-01','23:59:59')

The result is only

```<code>{
    "result": [
        {
            "number": "TK00001"
        }
}
</code>```

If my URI is

https://MyInstance.service-now.com/api/now/table/ticket?sysparm_exclude_reference_link=true&sysparm_query=sys_updated_onBETWEENjavascript:gs.dateGenerate('2020-09-01','00:00:00')@javascript:gs.dateGenerate('2020-09-01','23:59:59')

Then I get the result

```<code>{
    "result": [
        {
            "number": "TK00001",
            "assigned_to (need the empid)":"MYQ001",
            "Other_Field1":"Other Value 1",
             :
             "Other_FieldN":"Other Value N"
        }
}
</code>```

So how do I pass the column names that has Spaces and parenthesis like  "assigned_to (need the empid)"

Thanks for the Help in Advance

Body:
I am new to constructing Rest API GET queries.

Need help in GET request of Rest API by passing the fields in sysparm_fields.

I trying to query a Table via Rest API URI by passing only a limited number of columns of the table using Sysparam_fields.

However few column names have Spaces and parenthesis in it. So the JSON result set is excluding those columns and respective data when I do a GET request.

So if I am querying with column names  "assigned_to (need the empid)" and  "Number", I only get "Number" data.

If I dont pass, sysparm_fields it is returning the result set with all the columns including "assigned_to (need the empid)"

My end point looks like this

https://MyInstance.service-now.com/api/now/table/ticket?sysparm_exclude_reference_link=true&sysparm_fields=number,assigned_to (need the empid)&sysparm_query=sys_updated_onBETWEENjavascript:gs.dateGenerate('2020-09-01','00:00:00')@javascript:gs.dateGenerate('2020-09-01','23:59:59')

The result is only

{
    "result": [
        {
            "number": "TK00001"
        }
}

If my URI is

https://MyInstance.service-now.com/api/now/table/ticket?sysparm_exclude_reference_link=true&sysparm_query=sys_updated_onBETWEENjavascript:gs.dateGenerate('2020-09-01','00:00:00')@javascript:gs.dateGenerate('2020-09-01','23:59:59')

Then I get the result

{
    "result": [
        {
            "number": "TK00001",
            "assigned_to (need the empid)":"MYQ001",
            "Other_Field1":"Other Value 1",
             :
             "Other_FieldN":"Other Value N"
        }
}

So how do I pass the column names that has Spaces and parenthesis like  "assigned_to (need the empid)"

Thanks for the Help in Advance


问:
Optimizaiton For Mobile Device
Below is the code I've been using to create a website. I'm in the process of getting it online but I am having trouble accessing it on a mobile device using the mobile network. No problems viewing the website using wi-fi, but on a mobile device the site will crash and none of the links will work.

On some web pages, I have a large number of photographs. Could this issue be solved via lazy loading of the photos on the page? Is there any script in the CSS or Javascript that's making the website difficult to use on a mobile device? Any knowledge about trying to solve this issue would be much appreciated.

```<code><!DOCTYPE html>
<html lang="en">

<meta name="viewport" content="width=device-width, initial-scale=1.0;" charset="utf-8">

<body>

<style>html{visibility: hidden; opacity: 0;}</style>

<title>MORIKOBOSHI・</title>

<div class="page-wrap">

<div class="cp_cont">
<input id="cp_toggle03" type="checkbox"/>
<div class="cp_mobilebar">
<label for="cp_toggle03" class="cp_menuicon">
<span></span>
</label>
</div>
<label id="h-menu_black" class="cp_toggle03" for="cp_menuicon"></label>
<div id="body" class="noscroll"></div>

<header class="cp_offcm03">

<nav>
<ul style="text-align: center; margin-left: 210px; overflow: hidden;">

<li style="border-bottom: .05px solid lightgray;"><a href="#">Home</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="#">Blog</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="#">About This Website</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="#">Bibliography</a></li>

<div class="searchbar">

<form id="frmSearch" class="search2" method="get" action="default.html" style=" padding-right: 10px; padding-top: 20px; text-align: center; position: inline;">
<input class="search2" id="txtSearch" type="text" placeholder="Custom Google Search" name="serach_bar" size="31" maxlength="255" value="" style="top: 185px; width: 180px; height: 26px;">
<input class="search1" type="submit" name="submition" value="Search" style="padding-left: 5px; top: 153px; height: 25px; width: 50px; display: inline-flex; justify-content: center;">
<input class="search2" type="hidden" name="sitesearch" value="default.html">

</form>
</div>

<script type="text/javascript">
 document.getElementById('frmSearch').onsubmit = function() {
 window.location = 'http://www.google.com/search?q=site:morikoboshi.com' + document.getElementById('txtSearch').value;
        return false;
    }

</script>

<script>
 document.getElementById('cp_toggle03').onchange = function() {
 if (document.getElementById('cp_toggle03').checked) {
 document.body.style.overflow = "hidden";
  } else {
 document.body.style.overflow = "";
  }
}

</script>

</ul>
</nav>
</header>

<div class="setsumei">

 <br><br><h1 style="text-align: center; font-size: 40px;">◯◯◯◯</h1>
    <br><p style="text-align: justify; font-size: 16px;"></p>

 <p style="text-align: center; font-size: 13px;">Author: ◯◯◯◯</p>
 <p style="text-align: center; font-size: 13px;">Photos/Videos Taken：◯◯◯◯/◯◯/◯◯</p>

 <br><br><p style="text-align: justify; font-size: 16px;">

    #
 </p>

</div>

<br><br><div class="image">

  <a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

</div>

<br><br><footer class="site-footer" style="font-size: 12px;">MORIKOBOSHI© | <a href="#">日本語</a></footer>

</div>
</div>

<style>

html {visibility: visible;
      opacity: 1;}

.body{background-color: white;
      font-family: sans-serif;}

 .searchbar{float: right;}

 .image{text-align: center;}

 .setsumei{margin-left: 20px;
           margin-right: 20px;}

 .footer{width: 100%;
           height: 40px;
           text-align: center;
           border-top: 1px solid black;
           position: absolute;
           bottom: 0;
           padding: 10px;}

 .page-wrap {
  min-height: 100%;
  /* equal to footer height */
  margin-bottom: -40px;
}

 .page-wrap:after {
  content: "";
  display: block;
  }

 .site-footer, .page-wrap:after {
  /* .push must be the same height as footer */
  height: 20px;
}

 .site-footer {
  text-align: center;
  border-top: 1px solid black;
  padding: 10px;
}

 *, *:before, *:after {
    padding-left: 0;
    margin: 0;
    box-sizing: border-box;

}

 ol, ul {
    list-style: none;
}

 a {
    text-decoration: none;
    color: black;
}

 .cp_cont {
    height: auto;
}

/* menu */
 .cp_offcm03 {
    position: relative;
    z-index: 5000;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    width: 100%;
    height: auto;
    padding-top: 0;
    -webkit-transition: transform 0.3s ease-in;
            transition: transform 0.3s ease-in;
    text-align: center;
    color: black;
    background-color: white;
}
 .cp_offcm03 nav,
 .cp_offcm03 ul {
    height: 100%;
}

 .cp_offcm03 li {
    display: inline-block;
    margin-right: -6px;
}

 .cp_offcm03 a {
    display: block;
    padding: 15px 45px;
    margin-bottom: -5px;
    -webkit-transition: background-color .3s ease-in;
            transition: background-color .3s ease-in;
}

 .cp_offcm03 a:hover {
    background-color: lightgray;
}

/* menu toggle */
 #cp_toggle03 {
    display: none;
}

 #cp_toggle03:checked ~ .cp_offcm03 {
    -webkit-transform: translateX(0);
                    transform: translateX(0);
}

 #cp_toggle03:checked ~ .cp_container {
    -webkit-transform: translateX(0);
                    transform: translateX(0);
}

 .cp_mobilebar {
    display: none;

}

/* content */
 .cp_container {
    position: relative;
    top: 0;
    padding: 35px auto;
    -webkit-transition: transform .3s ease-in;
            transition: transform .3s ease-in;
}

 .cp_content {
    margin: 0 auto;
    padding: 20px;
    height: 65vh;
    text-align: center;

}

@media (max-width: 1130px)and (min-width: 280px) {
/* menu */
 .cp_offcm03 {
        position: fixed;
        left: -250px;
        overflow-y: hidden;
        width: 250px;
        height: 100%;
        padding-top: 40px;
        color: black;
        background-color: white;
        z-index: 1000;
    }

 .cp_offcm03 nav {
        background: white;
        border-right: 0.5px solid lightgray;
        margin-left: -210px;
    }

 .cp_offcm03 li {
        display: block;
        margin-right: 0;}

 .cp_offcm03 a {
        padding: 20px;

    }

/* menu toggle */
 .cp_mobilebar {
        display: block;
        z-index: 2000;
        position: relative;
        top: 0;
        left: 0;
        padding: 0 25px;
        width: 100%;
        height: 40px;
        background-color: white;
        border-bottom: .05px solid lightgray;

    }

 .cp_menuicon {
        display: block;
        position: relative;
        width: 25px;
        height: 100%;
        cursor: pointer;
        -webkit-transition: transform .3s ease-in;
                transition: transform .3s ease-in;
    }
 .cp_menuicon > span {
        display: block;
        position: absolute;
        top: 55%;
        margin-top: -0.3em;
        width: 100%;
        height: 0.2em;
        border-radius: 1px;
        background-color: black;
        -webkit-transition: transform .3s ease;
                transition: transform .3s ease;
    }
 .cp_menuicon > span:before,
 .cp_menuicon > span:after {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        border-radius: 1px;
        background-color: black;
        -webkit-transition: transform .3s ease-in;
                transition: transform .3s ease-in;
    }

 .cp_menuicon > span:before {
        -webkit-transform: translateY(-0.6em);
                transform: translateY(-0.6em);
    }

 .cp_menuicon > span:after {
        -webkit-transform: translateY(0.6em);
                transform: translateY(0.6em);
    }

 #cp_toggle03:checked + .cp_mobilebar .cp_menuicon {
        -webkit-transform: rotate(45deg);
                transform: rotate(45deg);
    }

 #cp_toggle03:checked + .cp_mobilebar span:before,
 #cp_toggle03:checked + .cp_mobilebar span:after {
        -webkit-transform: rotate(90deg);
                transform: rotate(90deg);
    }

 #cp_toggle03:checked ~ .cp_offcm03 {
        -webkit-transform: translateX(100%);
                transform: translateX(100%);
    }

 #cp_toggle03:checked ~ .cp_container {
        -webkit-transform: translateX(250px);
                transform: translateX(250px);
    }

 input:checked ~ #h-menu_black {
    display: block;/*カバーを表示*/
    opacity: .6;
}

 #h-menu_black {
    display: none;
    position: fixed;
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    opacity: 0;
    transition: .7s ease-in-out;
}

/* content */
 .cp_container {
        top: 60px;
        height: 92vh;
        text-align: center;
    }

 .noscroll{
        overflow: hidden;
        position: fixed;
    }

</style>

</body>
</html>
</code>```

Title: Optimizaiton For Mobile Device

Body:
Below is the code I've been using to create a website. I'm in the process of getting it online but I am having trouble accessing it on a mobile device using the mobile network. No problems viewing the website using wi-fi, but on a mobile device the site will crash and none of the links will work.

On some web pages, I have a large number of photographs. Could this issue be solved via lazy loading of the photos on the page? Is there any script in the CSS or Javascript that's making the website difficult to use on a mobile device? Any knowledge about trying to solve this issue would be much appreciated.

<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1.0;" charset="utf-8">

<title>MORIKOBOSHI・</title>

<input id="cp_toggle03" type="checkbox"/>

Home

Blog

About This Website

Bibliography

<form id="frmSearch" class="search2" method="get" action="default.html" style=" padding-right: 10px; padding-top: 20px; text-align: center; position: inline;">
<input class="search2" id="txtSearch" type="text" placeholder="Custom Google Search" name="serach_bar" size="31" maxlength="255" value="" style="top: 185px; width: 180px; height: 26px;">
<input class="search1" type="submit" name="submition" value="Search" style="padding-left: 5px; top: 153px; height: 25px; width: 50px; display: inline-flex; justify-content: center;">
<input class="search2" type="hidden" name="sitesearch" value="default.html">

</form>

◯◯◯◯

Author: ◯◯◯◯

Photos/Videos Taken：◯◯◯◯/◯◯/◯◯

    #

MORIKOBOSHI© | 日本語


问:
Error Loading PDF Files in React-PDF `Worker was destroyed`
I am trying to create a custom PDF viewer with react-pdf v6.2.0 to load in PDFs that I get from an API that are stored as base64 strings.

The following is the code I currently have:

```<code>import React, { useState } from "react";
import { Document, Page } from "react-pdf/dist/esm/entry.webpack";

export function PDFViewer({ pdfFile }) {
  const [numPages, setNumPages] = useState(null);
  const [pageNumber, setPageNumber] = useState(1);

  return (
    <>
      <Document
        file={`data:application/pdf;base64,${pdfFile}`}
        onLoadSuccess={({ numPages }) => {
          console.log(`PDF File drawingId: ${pdfFile.DrawingId}`);
          setNumPages(numPages);
          setPageNumber(1);
          alert("PDF document loaded successfully!");
        }}
        onLoadProgress={({ loaded, total }) =>
          alert("Loading a document: " + (loaded / total) * 100 + "%")
        }
        onLoadError={(error) =>
          alert("Error while loading document! " + error.message)
        }
        onSourceSuccess={() => alert("Document source retrieved!")}
        onSourceError={(error) =>
          alert("Error while retrieving document source! " + error.message)
        }
      >
        <Page pageNumber={pageNumber || 1} />
      </Document>
    </>
  );
}
</code>```

When I run the code, I get "Document source retrieved!" twice, followed by "Error while loading document! Worker was destroyed", followed by "Loading a document: 100%", and finally "PDF document loaded successfully" even though nothing is shown or the a PDF page is shown.

Thee issue is that for some PDFs nothing is displayed and for all PDFs, regardless of if there is a page displayed, I get the "Worker was destroyed" error and the "Document source retrieved" message twice.

Do you have any ideas what the issue is and what can be done to solve this?

Body:
I am trying to create a custom PDF viewer with react-pdf v6.2.0 to load in PDFs that I get from an API that are stored as base64 strings.

The following is the code I currently have:

import React, { useState } from "react";
import { Document, Page } from "react-pdf/dist/esm/entry.webpack";

export function PDFViewer({ pdfFile }) {
  const [numPages, setNumPages] = useState(null);
  const [pageNumber, setPageNumber] = useState(1);

  return (
    <>
      <Document
        file={`data:application/pdf;base64,${pdfFile}`}
        onLoadSuccess={({ numPages }) => {
          console.log(`PDF File drawingId: ${pdfFile.DrawingId}`);
          setNumPages(numPages);
          setPageNumber(1);
          alert("PDF document loaded successfully!");
        }}
        onLoadProgress={({ loaded, total }) =>
          alert("Loading a document: " + (loaded / total) * 100 + "%")
        }
        onLoadError={(error) =>
          alert("Error while loading document! " + error.message)
        }
        onSourceSuccess={() => alert("Document source retrieved!")}
        onSourceError={(error) =>
          alert("Error while retrieving document source! " + error.message)
        }
      >
        <Page pageNumber={pageNumber || 1} />
      </Document>
    </>
  );
}

When I run the code, I get "Document source retrieved!" twice, followed by "Error while loading document! Worker was destroyed", followed by "Loading a document: 100%", and finally "PDF document loaded successfully" even though nothing is shown or the a PDF page is shown.

Thee issue is that for some PDFs nothing is displayed and for all PDFs, regardless of if there is a page displayed, I get the "Worker was destroyed" error and the "Document source retrieved" message twice.

Do you have any ideas what the issue is and what can be done to solve this?