问:
Postgres Left Join ignores row if ManyToOne property is null
In Spring Boot i have the following query in a PostgreSQL database, to get data from ConfigElement table and set them to the new one ConfigurationReview table. It works properly as expected:

```<code>@Query(
          "SELECT new xx.xx.xx.dao.ConfigurationReview(r.id, MAX(ce.id) AS configElementId,"
        + " r.checkMethod, r.targetDate, r.endDate, r.sessionDate, SUM(CASE WHEN i.criticality ="
        + " 0 AND i.relation = 0 THEN 1 ELSE 0 END) AS majorFindings, SUM(CASE WHEN i.criticality"
        + " = 1 AND i.relation = 0 THEN 1 ELSE 0 END) AS minorFindings, r.state) FROM"
        + " ConfigElement ce "
        + "LEFT JOIN ce.reviews r ON r.configElement.id = ce.id "
        + "LEFT JOIN r.criteria cr ON cr.review.id = r.id "
        + "LEFT JOIN cr.issues i ON i.criterion.id = cr.id "
        + "WHERE ce.id = :configurationId AND r.id IS NOT NULL GROUP BY r.id")
  Page<ConfigurationReview> findConfigurationReviews(
          @Param("configurationId") Long configurationId, Pageable pageable);
</code>```

There was a need to add another property (r.milestone) with a ManyToOne relation, so i added it to the query:

```<code>@Query(
          "SELECT new xx.xx.xx.dao.ConfigurationReview(r.id, MAX(ce.id) AS configElementId,"
        + " r.checkMethod, r.targetDate, r.endDate, r.sessionDate, SUM(CASE WHEN i.criticality ="
        + " 0 AND i.relation = 0 THEN 1 ELSE 0 END) AS majorFindings, SUM(CASE WHEN i.criticality"
        + " = 1 AND i.relation = 0 THEN 1 ELSE 0 END) AS minorFindings, r.state, r.milestone) FROM"
        + " ConfigElement ce "
        + "LEFT JOIN ce.reviews r ON r.configElement.id = ce.id "
        + "LEFT JOIN r.criteria cr ON cr.review.id = r.id "
        + "LEFT JOIN cr.issues i ON i.criterion.id = cr.id "
        + "WHERE ce.id = :configurationId AND r.id IS NOT NULL GROUP BY r.id")
  Page<ConfigurationReview> findConfigurationReviews(
          @Param("configurationId") Long configurationId, Pageable pageable);
</code>```

Here is the milestone entry in ConfigurationReview dao:

```<code>@ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(foreignKey = @ForeignKey(name = "fk_review_milestones_on_milestone_id"))
  private Milestone milestone;
</code>```

With the above changes, it works properly if r.milestone is not null. But when the r.milestone is null, the complete row is ignored in left join.

As a result, if I have 2 r.milestones with data and 2 r.milestones without, the above query returns only two entries instead of four.

The problem appears only if r.milestone is null (because of the ManyToOne relation?). If another property is null, the row is returned properly.

Any idea how can I fix this?

Body:
In Spring Boot i have the following query in a PostgreSQL database, to get data from ConfigElement table and set them to the new one ConfigurationReview table. It works properly as expected:

@Query(
          "SELECT new xx.xx.xx.dao.ConfigurationReview(r.id, MAX(ce.id) AS configElementId,"
        + " r.checkMethod, r.targetDate, r.endDate, r.sessionDate, SUM(CASE WHEN i.criticality ="
        + " 0 AND i.relation = 0 THEN 1 ELSE 0 END) AS majorFindings, SUM(CASE WHEN i.criticality"
        + " = 1 AND i.relation = 0 THEN 1 ELSE 0 END) AS minorFindings, r.state) FROM"
        + " ConfigElement ce "
        + "LEFT JOIN ce.reviews r ON r.configElement.id = ce.id "
        + "LEFT JOIN r.criteria cr ON cr.review.id = r.id "
        + "LEFT JOIN cr.issues i ON i.criterion.id = cr.id "
        + "WHERE ce.id = :configurationId AND r.id IS NOT NULL GROUP BY r.id")
  Page<ConfigurationReview> findConfigurationReviews(
          @Param("configurationId") Long configurationId, Pageable pageable);

There was a need to add another property (r.milestone) with a ManyToOne relation, so i added it to the query:

@Query(
          "SELECT new xx.xx.xx.dao.ConfigurationReview(r.id, MAX(ce.id) AS configElementId,"
        + " r.checkMethod, r.targetDate, r.endDate, r.sessionDate, SUM(CASE WHEN i.criticality ="
        + " 0 AND i.relation = 0 THEN 1 ELSE 0 END) AS majorFindings, SUM(CASE WHEN i.criticality"
        + " = 1 AND i.relation = 0 THEN 1 ELSE 0 END) AS minorFindings, r.state, r.milestone) FROM"
        + " ConfigElement ce "
        + "LEFT JOIN ce.reviews r ON r.configElement.id = ce.id "
        + "LEFT JOIN r.criteria cr ON cr.review.id = r.id "
        + "LEFT JOIN cr.issues i ON i.criterion.id = cr.id "
        + "WHERE ce.id = :configurationId AND r.id IS NOT NULL GROUP BY r.id")
  Page<ConfigurationReview> findConfigurationReviews(
          @Param("configurationId") Long configurationId, Pageable pageable);

Here is the milestone entry in ConfigurationReview dao:

@ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(foreignKey = @ForeignKey(name = "fk_review_milestones_on_milestone_id"))
  private Milestone milestone;

With the above changes, it works properly if r.milestone is not null. But when the r.milestone is null, the complete row is ignored in left join.

As a result, if I have 2 r.milestones with data and 2 r.milestones without, the above query returns only two entries instead of four.

The problem appears only if r.milestone is null (because of the ManyToOne relation?). If another property is null, the row is returned properly.

Any idea how can I fix this?


来源: stackexchange

问:
Angular14 reactive form getRawValue() returning incompatible types
After Angular14 update, some of my forms are returning incompatible types such as

name: ((control: AbstractControl<any, any>) => ValidationErrors)[];

When creating a form like:

```<code> form = this.fb.group({
    id: {value: null, disabled: true},
    name: [null, [Validators.required, Validators.maxLength(191)]])}
</code>```

And passing to my service:

```<code>this.service.updateProfile(this.form.getRawValue());
</code>```

Argument of type '{ id: any; name: ((control: AbstractControl<any, any>) => ValidationErrors)[];}' is not assignable to parameter of type 'Partial'.
Types of property 'name' are incompatible.
Type '((control: AbstractControl<any, any>) => ValidationErrors)[]' is not assignable to type 'string'.

Service accepts

```<code>export interface UserProfile {
id: string;
name: string;}
</code>```

All this forms worked fine before typed forms. Same result if using .value instead of getRawValue()

ContentLicense: CC BY-SA 4.0

Body:
After Angular14 update, some of my forms are returning incompatible types such as

name: ((control: AbstractControl<any, any>) => ValidationErrors)[];

When creating a form like:

 form = this.fb.group({
    id: {value: null, disabled: true},
    name: [null, [Validators.required, Validators.maxLength(191)]])}

And passing to my service:

this.service.updateProfile(this.form.getRawValue());

Argument of type '{ id: any; name: ((control: AbstractControl<any, any>) => ValidationErrors)[];}' is not assignable to parameter of type 'Partial'.
Types of property 'name' are incompatible.
Type '((control: AbstractControl<any, any>) => ValidationErrors)[]' is not assignable to type 'string'.

Service accepts

export interface UserProfile {
id: string;
name: string;}

All this forms worked fine before typed forms. Same result if using .value instead of getRawValue()


问:
How to fix pip install openai error: subprocess-exited-with-error
I installed the openai package, but there was an error. I have no idea about this error. The Python version is 3.11.1, and the pip version is 22.3.1.

```<code>Collecting openai
  Using cached openai-0.26.0.tar.gz (54 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "C:\Users\chase\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process          main()
        File "C:\Users\chase\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chase\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chase\AppData\Local\Temp\pip-build-env-b5meduhi\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chase\AppData\Local\Temp\pip-build-env-b5meduhi\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "C:\Users\chase\AppData\Local\Temp\pip-build-env-b5meduhi\overlay\Lib\site-packages\setuptools\build_meta.py", line 485, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chase\AppData\Local\Temp\pip-build-env-b5meduhi\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 13, in <module>
      UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 1031: illegal multibyte sequence
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
</code>```

I checked the pip and python versions. There seems to be no problem with the version.

Body:
I installed the openai package, but there was an error. I have no idea about this error. The Python version is 3.11.1, and the pip version is 22.3.1.

Collecting openai
  Using cached openai-0.26.0.tar.gz (54 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "C:\Users\chase\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process          main()
        File "C:\Users\chase\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chase\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chase\AppData\Local\Temp\pip-build-env-b5meduhi\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chase\AppData\Local\Temp\pip-build-env-b5meduhi\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "C:\Users\chase\AppData\Local\Temp\pip-build-env-b5meduhi\overlay\Lib\site-packages\setuptools\build_meta.py", line 485, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\chase\AppData\Local\Temp\pip-build-env-b5meduhi\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 13, in <module>
      UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 1031: illegal multibyte sequence
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I checked the pip and python versions. There seems to be no problem with the version.


问:
Levels for several variables with for loop (R)
I want to see the level as an output of several variables.
Let's say I have 9 variables, and I could do it like this:

```<code>levels(myd$tel_1)
levels(myd$tel_2)
levels(myd$tel_3)
...
</code>```

But I want to improve it by using a for loop. I think it's useless to use the same function instead of the same code copied underneath.

I've tried something like this:

```<code>block <-
  c("tel_1",
  "tel_2",
  "tel_3",
  "tel_4",
  "tel_5",
  "tel_6",
  "tel_7",
  "tel_8",
  "tel_9")
  for (j in block) {
    levels(myd[[j]])
  }
</code>```

But this does not work, no error message, nothing. Only the code copied into the console.
Thanks for help!

Body:
I want to see the level as an output of several variables.
Let's say I have 9 variables, and I could do it like this:

levels(myd$tel_1)
levels(myd$tel_2)
levels(myd$tel_3)
...

But I want to improve it by using a for loop. I think it's useless to use the same function instead of the same code copied underneath.

I've tried something like this:

block <-
  c("tel_1",
  "tel_2",
  "tel_3",
  "tel_4",
  "tel_5",
  "tel_6",
  "tel_7",
  "tel_8",
  "tel_9")
  for (j in block) {
    levels(myd[[j]])
  }

But this does not work, no error message, nothing. Only the code copied into the console.
Thanks for help!


问:
Is there a way to switch a flag from True to False in a function that is called by the main function without changing the main function?
I have my main function market_info that calls on another function market_info2 as follows:

```<code>class MarketData:
    def market_info2(md):
        ...
        return something

class example(MarketData):
    def __init__(self, ss):
        super().__init__(ss)

    def market_info(self, merge_rows=True, **kwargs):
        mkt_info_df = super().market_info2()

        if marge_rows:
            do_something
        else:
            do_something_else
</code>```

In my main function market_info I would like to switch the flag merge_rows from True to False, is there anyway to do this WITHOUT CHANGING ANYHING in the main function market_info?

Body:
I have my main function market_info that calls on another function market_info2 as follows:

class MarketData:
    def market_info2(md):
        ...
        return something

class example(MarketData):
    def __init__(self, ss):
        super().__init__(ss)

    def market_info(self, merge_rows=True, **kwargs):
        mkt_info_df = super().market_info2()

        if marge_rows:
            do_something
        else:
            do_something_else

In my main function market_info I would like to switch the flag merge_rows from True to False, is there anyway to do this WITHOUT CHANGING ANYHING in the main function market_info?


问:
Groupby ID and Count of col1 and apply conditional filters on Count col and the col1 and return a value

Pandas Group by ID and count of RAG_col

If RAG_Col = 'R' AND Count of RAG_Col value is >=2 return 'R'
Similarly if RAG_Col = 'A' AND Count of RAG_Col value is >=2 return 'A'
Similarly if RAG_Col = 'G'&'A'&'R' and Count of RAG_Col value is ==1 return 'A'
else 'G'
After applying groupby and conditional filters and count RAG_Col I should get Overall_ALL RAG for each unique ID

A = ID
B = RAG

```<code>df['Overall RAG] = df.groupby(['A','B'])['B'].count().reset_index(name = 'C').apply(lambda x: 'R' if x.B == 'R' & x.C>=2 else 'A' if x.B == 'A' & x.C>=2
else 'A' if x.B=='A' & x.B == 'G' & x.B=='R' & x.C == 1
else 'G'if x.B!='' & x.C == '')
</code>```

But I'm getting the Inavlid syntax not able to apply these conditions using lambda expression using groupby

Body:
Pandas Group by ID and count of RAG_col

If RAG_Col = 'R' AND Count of RAG_Col value is >=2 return 'R'
Similarly if RAG_Col = 'A' AND Count of RAG_Col value is >=2 return 'A'
Similarly if RAG_Col = 'G'&'A'&'R' and Count of RAG_Col value is ==1 return 'A'
else 'G'
After applying groupby and conditional filters and count RAG_Col I should get Overall_ALL RAG for each unique ID

A = ID
B = RAG

df['Overall RAG] = df.groupby(['A','B'])['B'].count().reset_index(name = 'C').apply(lambda x: 'R' if x.B == 'R' & x.C>=2 else 'A' if x.B == 'A' & x.C>=2
else 'A' if x.B=='A' & x.B == 'G' & x.B=='R' & x.C == 1
else 'G'if x.B!='' & x.C == '')

But I'm getting the Inavlid syntax not able to apply these conditions using lambda expression using groupby


问:
Why does vscode shows a red origin/master when GitHub has the proper commit?
I am using vscode to commit and push my code to GitHub. After fumbling with the credentials, I finally managed to correctly push the local commit to GitHub.

In the vscode Git History tab, I see

origin/HEAD and origin/master are in red (which does not look good), on the a836606 commit.

Looking directly on GitHub, I see that this commit is there as expected:

Does the red color of the badges indeed suggest that something is wrong?


问:
blank screen and no error message react.js
I was following the react-dnd tutorial. and completed half of the step that is when I come across an error.
my app was running fine but when I made the change in the Game.js file that is when my screen went blank.

Index.js

import React from 'react';
import ReactDOM from 'react-dom/client';
import reportWebVitals from './reportWebVitals';
import Board from './Board';
import { observe } from './Game'

const root = ReactDOM.createRoot(document.getElementById("root"));

root.render(
  <React.StrictMode>
    {
    observe((knightPosition) =>
    root.render(<Board knightPosition={knightPosition}/>)
    )}
  </React.StrictMode>
);

reportWebVitals();```
</div>
</div>
</p>
<p><strong>Game.js</strong></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let knightPosition = [0, 0]
let observer = null

function emitChange() {
  observer(knightPosition)
}

export function observe(o) {
  if (observer) {
    throw new Error('Multiple observers not implemented.')
  }

  observer = o
  emitChange()
}

export function moveKnight(toX, toY) {
  knightPosition = [toX, toY]
  emitChange()
}</code>```

Game.js (before|working code)

export function observe(receive) {
  const randPos = () => Math.floor(Math.random() * 8)
  setInterval(() => receive([randPos(), randPos()]), 500)
}```

this is the tutorial I am following

Body:
I was following the react-dnd tutorial. and completed half of the step that is when I come across an error.
my app was running fine but when I made the change in the Game.js file that is when my screen went blank.

Index.js

import React from 'react';
import ReactDOM from 'react-dom/client';
import reportWebVitals from './reportWebVitals';
import Board from './Board';
import { observe } from './Game'

const root = ReactDOM.createRoot(document.getElementById("root"));

root.render(
  <React.StrictMode>
    {
    observe((knightPosition) =>
    root.render(<Board knightPosition={knightPosition}/>)
    )}
  </React.StrictMode>
);

reportWebVitals();

Game.js

let knightPosition = [0, 0]
let observer = null

function emitChange() {
  observer(knightPosition)
}

export function observe(o) {
  if (observer) {
    throw new Error('Multiple observers not implemented.')
  }

  observer = o
  emitChange()
}

export function moveKnight(toX, toY) {
  knightPosition = [toX, toY]
  emitChange()
}

Game.js (before|working code)

export function observe(receive) {
  const randPos = () => Math.floor(Math.random() * 8)
  setInterval(() => receive([randPos(), randPos()]), 500)
}

this is the tutorial I am following


问:
Hierachical time-series clustering by labels in 'base' and 'dplyr'
I want to do a hierarchical time series clustering of financial data from eurostat for EU-27 countries. I want to group values by time-series at first, and then add country name as labels in dendrogram.

Here is the head of my data:

```<code>> head(data)
  geo  unit coicop       time values    name   label
1  AT RCH_A   CP00 2001-04-01    2.6 Austria Austria
2  AT RCH_A   CP00 2007-03-01    1.9 Austria Austria
3  AT RCH_A   CP00 2011-09-01    3.9 Austria Austria
4  AT RCH_A   CP00 2018-10-01    2.4 Austria Austria
5  AT RCH_A   CP00 2017-03-01    2.1 Austria Austria
</code>```

So many dates for one country.

I tried at first to group values by time_series, make distance matrix and hierarchical clusting and then add country name labels while presenting a plot:

```<code>df_long <- aggregate(values~time, data=data, FUN=mean)

hc <- hclust(dist(df_long[,"values"], method="minkowski", p=1.5), method="average")

plot(hc, labels=data$name, hang=-1)
</code>```

But as you can expect I get an error:

```<code>> plot(hc, labels=data$name, hang=-1)
Error in graphics:::plotHclust(n1, merge, height, order(x$order), hang,  :
  invalid dendrogram input
</code>```

Way that has been choosed by me is fine or should I go another way to cluster time-series?

I already got mean values clutering only by countries, but I want to compare values from every date between countries.

Full code:

```<code>
data <- get_eurostat("prc_hicp_manr")

data <- filter(data, time >= "2000-03-01" & time <= "2022-09-30" & coicop == "CP00")

country_name <- eurostat::eu_countries

data <- merge(data, country_name, by.x = "geo", by.y = "code")

unique(data$name)

data <- filter(data, name != "" & name != "United Kingdom")

unique(data$name)

sum(is.na(data$name))

ggplot(data) +
  aes(x = time, y = values, colour = name) +
  geom_line() +
  scale_color_hue(direction = 1) +
  labs(title = "Przebiegi HICP dla krajow UE") +
  theme_bw() +
  theme(plot.title = element_text(size = 20L, hjust = 0.5))

head(data)

data_by_country <- data %>%
  group_by(name) %>%
  summarize(value = sum(values)) %>%
  ungroup() %>%
  as.matrix()

data_by_country <- as.data.frame(data_by_country)

rownames(data_by_country) <- data_by_country$name

plot(hclust(dist(data_by_country[, "value", drop=F], method = "minkowski", p = 1,5), method = "complete"), main = "Clustering countries based on HICP", xlab = NA, sub = NA)

hc <- hclust(dist(data_by_country[, "value", drop=F], method = "minkowski", p = 1,5), method = "complete")

clusters <- cutree(hc, 4)

rect.hclust(hc, k = 4, border = "red")

</code>```

Body:
I want to do a hierarchical time series clustering of financial data from eurostat for EU-27 countries. I want to group values by time-series at first, and then add country name as labels in dendrogram.

Here is the head of my data:

> head(data)
  geo  unit coicop       time values    name   label
1  AT RCH_A   CP00 2001-04-01    2.6 Austria Austria
2  AT RCH_A   CP00 2007-03-01    1.9 Austria Austria
3  AT RCH_A   CP00 2011-09-01    3.9 Austria Austria
4  AT RCH_A   CP00 2018-10-01    2.4 Austria Austria
5  AT RCH_A   CP00 2017-03-01    2.1 Austria Austria

So many dates for one country.

I tried at first to group values by time_series, make distance matrix and hierarchical clusting and then add country name labels while presenting a plot:

df_long <- aggregate(values~time, data=data, FUN=mean)

hc <- hclust(dist(df_long[,"values"], method="minkowski", p=1.5), method="average")

plot(hc, labels=data$name, hang=-1)

But as you can expect I get an error:

> plot(hc, labels=data$name, hang=-1)
Error in graphics:::plotHclust(n1, merge, height, order(x$order), hang,  :
  invalid dendrogram input

Way that has been choosed by me is fine or should I go another way to cluster time-series?

I already got mean values clutering only by countries, but I want to compare values from every date between countries.

Full code:

data <- get_eurostat("prc_hicp_manr")

data <- filter(data, time >= "2000-03-01" & time <= "2022-09-30" & coicop == "CP00")

country_name <- eurostat::eu_countries

data <- merge(data, country_name, by.x = "geo", by.y = "code")

unique(data$name)

data <- filter(data, name != "" & name != "United Kingdom")

unique(data$name)

sum(is.na(data$name))

ggplot(data) +
  aes(x = time, y = values, colour = name) +
  geom_line() +
  scale_color_hue(direction = 1) +
  labs(title = "Przebiegi HICP dla krajow UE") +
  theme_bw() +
  theme(plot.title = element_text(size = 20L, hjust = 0.5))

head(data)

data_by_country <- data %>%
  group_by(name) %>%
  summarize(value = sum(values)) %>%
  ungroup() %>%
  as.matrix()

data_by_country <- as.data.frame(data_by_country)

rownames(data_by_country) <- data_by_country$name

plot(hclust(dist(data_by_country[, "value", drop=F], method = "minkowski", p = 1,5), method = "complete"), main = "Clustering countries based on HICP", xlab = NA, sub = NA)

hc <- hclust(dist(data_by_country[, "value", drop=F], method = "minkowski", p = 1,5), method = "complete")

clusters <- cutree(hc, 4)

rect.hclust(hc, k = 4, border = "red")


问:
Mean square displacement with a non-linearly spaced time series
I'm trying to calculate the mean square displacement of a time series.

This is the following function when I consider that the time intervals in the time series are equal:

```<code>function [msdpts, sem] = msd_2D(x,y,N)
    r = sqrt(x.^2 + y.^2);
    sem = zeros(N, 1);
    msdpts = zeros(N, 1);
    for i = 1:N
        sqdisp = (r(1+i:end) - r(1:end-i)).^2;
        sem(i) = std(sqdisp)/sqrt(N);
        msdpts(i) = mean(sqdisp);
    end
end
</code>```

How can this code can be written when the time intervals in the time series are random (not equal)?

Note: Linearizing the time series in this case is not an option.

Body:
I'm trying to calculate the mean square displacement of a time series.

This is the following function when I consider that the time intervals in the time series are equal:

function [msdpts, sem] = msd_2D(x,y,N)
    r = sqrt(x.^2 + y.^2);
    sem = zeros(N, 1);
    msdpts = zeros(N, 1);
    for i = 1:N
        sqdisp = (r(1+i:end) - r(1:end-i)).^2;
        sem(i) = std(sqdisp)/sqrt(N);
        msdpts(i) = mean(sqdisp);
    end
end

How can this code can be written when the time intervals in the time series are random (not equal)?

Note: Linearizing the time series in this case is not an option.


问:
Baileys | error while compiling example.ts file
I cloned this repository: https://github.com/adiwajshing/Baileys.
When I compile the example.ts file via the yarn example command, which is located in the ./Example/example.ts folder, the following error occurs:

```<code>PS D:\Programming\Web\Baileys> yarn example
yarn run v1.22.19
$ node --inspect -r ts-node/register Example/example.ts
Debugger listening on ws://127.0.0.1:9229/c6e4eec7-1dea-4762-8fa6-a10bcd74aa7a
For help, see: https://nodejs.org/en/docs/inspector
using WA v2.2243.7, isLatest: true
D:\Programming\Web\Baileys\src\Socket\socket.js:57
    var ws = new ws_1["default"](waWebSocketUrl, undefined, {
             ^
TypeError: ws_1.default is not a constructor
    at makeSocket (D:\Programming\Web\Baileys\src\Socket\socket.js:57:14)
    at makeChatsSocket (D:\Programming\Web\Baileys\src\Socket\chats.js:63:40)
    at makeGroupsSocket (D:\Programming\Web\Baileys\src\Socket\groups.js:57:44)
    at makeMessagesSocket (D:\Programming\Web\Baileys\src\Socket\messages-send.js:61:46)
    at makeMessagesRecvSocket (D:\Programming\Web\Baileys\src\Socket\messages-recv.js:62:55)
    at makeBusinessSocket (D:\Programming\Web\Baileys\src\Socket\business.js:56:59)
    at makeWASocket (D:\Programming\Web\Baileys\src\Socket\index.js:17:82)
    at startSock (D:\Programming\Web\Baileys\Example\example.ts:31:27)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
</code>```

what is it connected with?

node
v18.7.0

tsc
Version 4.9.4

yarn
1.12.19

I tried to solve the problem by changing the imports as mentioned here https://github.com/node-cache/node-cache/issues/59, but it didn't help.

Body:
I cloned this repository: https://github.com/adiwajshing/Baileys.
When I compile the example.ts file via the yarn example command, which is located in the ./Example/example.ts folder, the following error occurs:

PS D:\Programming\Web\Baileys> yarn example
yarn run v1.22.19
$ node --inspect -r ts-node/register Example/example.ts
Debugger listening on ws://127.0.0.1:9229/c6e4eec7-1dea-4762-8fa6-a10bcd74aa7a
For help, see: https://nodejs.org/en/docs/inspector
using WA v2.2243.7, isLatest: true
D:\Programming\Web\Baileys\src\Socket\socket.js:57
    var ws = new ws_1["default"](waWebSocketUrl, undefined, {
             ^
TypeError: ws_1.default is not a constructor
    at makeSocket (D:\Programming\Web\Baileys\src\Socket\socket.js:57:14)
    at makeChatsSocket (D:\Programming\Web\Baileys\src\Socket\chats.js:63:40)
    at makeGroupsSocket (D:\Programming\Web\Baileys\src\Socket\groups.js:57:44)
    at makeMessagesSocket (D:\Programming\Web\Baileys\src\Socket\messages-send.js:61:46)
    at makeMessagesRecvSocket (D:\Programming\Web\Baileys\src\Socket\messages-recv.js:62:55)
    at makeBusinessSocket (D:\Programming\Web\Baileys\src\Socket\business.js:56:59)
    at makeWASocket (D:\Programming\Web\Baileys\src\Socket\index.js:17:82)
    at startSock (D:\Programming\Web\Baileys\Example\example.ts:31:27)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

what is it connected with?

node
v18.7.0

tsc
Version 4.9.4

yarn
1.12.19

I tried to solve the problem by changing the imports as mentioned here https://github.com/node-cache/node-cache/issues/59, but it didn't help.


问:
anchor element with > target = "_blank" < not showing up in laravel telescope entries
I have an anchor element that has a taget="_blank" attribute.

```<code><span class="cell">
    <a href="{{ route('contact.files.read', $file->uuid) }}" target="_blank">
        {{ $file->name }}
    </a>
</span>
</code>```

Accessing the route via this element hides the request from telescope; request is not show in telescope entries.

Refreshes made in the newly opened tab are shown.

Removing the target attribute and using the element, produces normal results ( request is shown in telescope entries ).

Also the log method is not ran. It almost seems like the method is not called at all.

Anyone has any idea why?
This is the controller method used:

```<code>public function read(Request $request, MyFile $file)
{
    Log::notice('read contact files',
        [
            'who' => $request->user()->id,
        ]);

    return response()->file(storage_path('app/' . $file->path), [
        'Cache-Control' => 'max-age=31536000',
    ]);
}
</code>```

Route definition:

```<code>Route::get('/contact/file/{file}', 'MyController@read')
    ->name('contact.files.read')
</code>```

Body:
I have an anchor element that has a taget="_blank" attribute.

    uuid) }}" target="_blank">
        {{ $file->name }}

Accessing the route via this element hides the request from telescope; request is not show in telescope entries.

Refreshes made in the newly opened tab are shown.

Removing the target attribute and using the element, produces normal results ( request is shown in telescope entries ).

Also the log method is not ran. It almost seems like the method is not called at all.

Anyone has any idea why?
This is the controller method used:

public function read(Request $request, MyFile $file)
{
    Log::notice('read contact files',
        [
            'who' => $request->user()->id,
        ]);

    return response()->file(storage_path('app/' . $file->path), [
        'Cache-Control' => 'max-age=31536000',
    ]);
}

Route definition:

Route::get('/contact/file/{file}', 'MyController@read')
    ->name('contact.files.read')


问:
Re-distributing messages from busy subscribers
We have the following set up in our project: Two applications are communicating via a GCP Pub/Sub message queue. The first application produces messages that trigger executions (jobs) in the second (i.e. the first is the controller, and the second is the worker). However, the execution time of these jobs can vary drastically. For example, one could take up to 6 hours, and another could finish in less than a minute. Currently, the worker picks up the messages, starts a job for each one, and acknowledges the messages after their jobs are done (which could be after several hours).

Now getting to the problem: The worker application runs on multiple instances, but sometimes we see very uneven message distribution across the different instances. Consider the following graph, for example:

It shows the number of messages processed by each worker instance at any given time. You can see that some are hitting the maximum of 15 (configured via the spring.cloud.gcp.pubsub.subscriber.executor-threads property) while others are idling at 1 or 2. At this point, we also start seeing messages without any started jobs (awaiting execution). We assume that these were pulled by the GCP Pub/Sub client in the busy instances but cannot yet be processed due to a lack of executor threads. The threads are busy because they're processing heavier and more time-consuming jobs.

Finally, the question: Is there any way to do backpressure (i.e. tell GCP Pub/Sub that an instance is busy and have it re-distribute the messages to a different one)? I looked into this article, but as far as I understood, the setMaxOutstandingElementCount method wouldn't help us because it would control how many messages the instance stores in its memory. They would, however, still be "assigned" to this instance/subscriber and would probably not get re-distributed to a different one. Is that correct, or did I misunderstand?

We want to utilize the worker instances optimally and have messages processed as quickly as possible. In theory, we could try to split up the more expensive jobs into several different messages, thus minimizing the processing time differences but is this the only option?


问:
How to make HTTP Request within onCreate in Kotlin
I am new to kotlin, I was wondering how to make a get HTTP request onCreate function</p>
```<code>package com.example.kotlin

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        //http request here
    }
}
</code>```

Body:
I am new to kotlin, I was wondering how to make a get HTTP request onCreate function

package com.example.kotlin

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        //http request here
    }
}


问:
Extension calls uninstalled function in V3 automatically
Chrome extension version v3 automatically   runs the chrome.runtime.setUninstallURL function. So its automatically triggers the logout.

I need the why its occur in v3 but not in v2.


问:
Is there a possibility of caching custom views across activities using MutableContextWrapper?
I am thinking, if we create a custom view using MutableContextWrapper(applicationContext), and keep it in singleton scope. And when we enter into different activities, we can do,
Fetch the view instance from the singleton. Then,
(MutableContextWrapper(view.getContext())).setBaseContext(activityCtxA).

I know it is not recommended to cache views like this but what are the side effects of it?

When I tried following the above approach, things are working fine prima facie as expected. I want to understand the corner cases that could break.


问:
How do i write a unit test case for connecting HTTP proxy server
I am implementing some unit test cases for my project and i got stuck in (starksoft-aspen library)
https://github.com/bentonstark/starksoft-aspen  HTTP connection proxy class ,  how can i mock this library to set up a connection to an HTTP proxy server.
Any input would be greatly appreciated.</p>
```<code> if (_tcpClient == null)
            {_tcpClient = new TcpClient();
            _tcpClient.Connect(_proxyHost, _proxyPort);
            }
            NetworkStream stream = _tcpClient.GetStream();
            string connectCmd = String.Format(CultureInfo.InvariantCulture, HTTP_PROXY_CONNECT_CMD, destinationHost, destinationPort.ToString(CultureInfo.InvariantCulture));
            byte[] request = ASCIIEncoding.ASCII.GetBytes(connectCmd);
            stream.Write(request, 0, request.Length);
            WaitForData(stream);
            byte[] response = new byte[_tcpClient.ReceiveBufferSize];
</code>```

Body:
I am implementing some unit test cases for my project and i got stuck in (starksoft-aspen library)
https://github.com/bentonstark/starksoft-aspen  HTTP connection proxy class ,  how can i mock this library to set up a connection to an HTTP proxy server.
Any input would be greatly appreciated.

 if (_tcpClient == null)
            {_tcpClient = new TcpClient();
            _tcpClient.Connect(_proxyHost, _proxyPort);
            }
            NetworkStream stream = _tcpClient.GetStream();
            string connectCmd = String.Format(CultureInfo.InvariantCulture, HTTP_PROXY_CONNECT_CMD, destinationHost, destinationPort.ToString(CultureInfo.InvariantCulture));
            byte[] request = ASCIIEncoding.ASCII.GetBytes(connectCmd);
            stream.Write(request, 0, request.Length);
            WaitForData(stream);
            byte[] response = new byte[_tcpClient.ReceiveBufferSize];


问:
How can I recover Gitlab?
I am using docker-compose to deploy the Gitlab
But it happened that the files are removed accidently.

In my docker-compose.yaml:

```<code>
  MY-gitlab:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    container_name: my-git
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['gitlab_shell_ssh_port'] = 2224
        external_url 'http://my-git'
    ports:
    - '8022:22'
    - '8443:443'
    - '8081:80'
    volumes:
    - "/var/run/docker.sock:/var/run/docker.sock:ro"
    - '/home/my/release/gitlab/config:/etc/gitlab'
    - '/home/my/release/gitlab/logs:/var/log/gitlab'
    - '/home/my/release/gitlab/data:/var/opt/gitlab'
</code>```

So my repositories are like :

```<code>$ cd /home/my/release/gitlab/data/git-data/repositories/'@hashed'
$ ll
total 60
drwxr-s--- 15 git git 4096 Oct 27 05:41 ./
drwxrws---  4 git git 4096 Oct 27 03:58 ../
drwxr-s---  3 git git 4096 Sep  8 05:10 19/
drwxr-s---  3 git git 4096 Sep  1 07:05 2c/
drwxr-s---  3 git git 4096 Oct 27 03:58 3f/
drwxr-s---  3 git git 4096 Sep 22 08:17 4a/
drwxr-s---  3 git git 4096 Jul 28 12:19 4b/
drwxr-s---  3 git git 4096 Jun  9  2022 4e/
drwxr-s---  3 git git 4096 Oct 12 08:49 4f/
drwxr-s---  4 git git 4096 Oct 13 07:16 6b/
drwxr-s---  3 git git 4096 Aug 29 07:32 79/
drwxr-s---  3 git git 4096 Oct 27 05:41 85/
drwxr-s---  3 git git 4096 Jun  9  2022 d4/
drwxr-s---  3 git git 4096 Aug 22 07:19 e7/
drwxr-s---  3 git git 4096 Aug 19 07:41 ef/
</code>```

The repos are hashed stored.
Now I need to recover as much as I can to restore the Gitlab.
How should I do to recover perfectly ?

Tried :

https://docs.gitlab.com/omnibus/settings/configuration.html#store-git-data-in-an-alternative-directory

https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/tasks/gitlab/import.rake

Both of them doesn't work. Or maybe I tried wrongly.

Title: How can I recover Gitlab?

Body:
I am using docker-compose to deploy the Gitlab
But it happened that the files are removed accidently.

In my docker-compose.yaml:

  MY-gitlab:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    container_name: my-git
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['gitlab_shell_ssh_port'] = 2224
        external_url 'http://my-git'
    ports:
    - '8022:22'
    - '8443:443'
    - '8081:80'
    volumes:
    - "/var/run/docker.sock:/var/run/docker.sock:ro"
    - '/home/my/release/gitlab/config:/etc/gitlab'
    - '/home/my/release/gitlab/logs:/var/log/gitlab'
    - '/home/my/release/gitlab/data:/var/opt/gitlab'

So my repositories are like :

$ cd /home/my/release/gitlab/data/git-data/repositories/'@hashed'
$ ll
total 60
drwxr-s--- 15 git git 4096 Oct 27 05:41 ./
drwxrws---  4 git git 4096 Oct 27 03:58 ../
drwxr-s---  3 git git 4096 Sep  8 05:10 19/
drwxr-s---  3 git git 4096 Sep  1 07:05 2c/
drwxr-s---  3 git git 4096 Oct 27 03:58 3f/
drwxr-s---  3 git git 4096 Sep 22 08:17 4a/
drwxr-s---  3 git git 4096 Jul 28 12:19 4b/
drwxr-s---  3 git git 4096 Jun  9  2022 4e/
drwxr-s---  3 git git 4096 Oct 12 08:49 4f/
drwxr-s---  4 git git 4096 Oct 13 07:16 6b/
drwxr-s---  3 git git 4096 Aug 29 07:32 79/
drwxr-s---  3 git git 4096 Oct 27 05:41 85/
drwxr-s---  3 git git 4096 Jun  9  2022 d4/
drwxr-s---  3 git git 4096 Aug 22 07:19 e7/
drwxr-s---  3 git git 4096 Aug 19 07:41 ef/

The repos are hashed stored.
Now I need to recover as much as I can to restore the Gitlab.
How should I do to recover perfectly ?

Tried :

https://docs.gitlab.com/omnibus/settings/configuration.html#store-git-data-in-an-alternative-directory

https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/tasks/gitlab/import.rake

Both of them doesn't work. Or maybe I tried wrongly.


问:
Tableau: Replace all patterns of date
I have a column Contact as shown below, where I wish to add the Number of days since the Call/Visit/Skype from today besides the dates in parenthesis.

```<code>Today: 10 Jan, 2023
</code>```

The desired output should be:

```<code>Call 22 Dec, 22 (19 Days); Visit 28 Dec, 22 (13 Days); Skype 20 Dec, 22 (21 Days)
Visit 18 Dec, 22 (23 Days); Skype 12 Dec, 22 (29 Days)
Call 05 Nov, 22 (66 Days); Visit 14 Dec, 22 (27 Days); Skype 01 Oct, 22 (100 Days)
</code>```

My attempt: 'Days since the contact' can be calculated like this. Following will give the number of days:

```<code>Today() - DATEPARSE('dd MMM, yy','22 Dec, 22')
</code>```

Now, how to use REGEXP_REPLACE() or some other functon to replace all these dates in a loop and replace them with the date+Number of days?

Title: Tableau: Replace all patterns of date

Body:
I have a column Contact as shown below, where I wish to add the Number of days since the Call/Visit/Skype from today besides the dates in parenthesis.

Today: 10 Jan, 2023

The desired output should be:

Call 22 Dec, 22 (19 Days); Visit 28 Dec, 22 (13 Days); Skype 20 Dec, 22 (21 Days)
Visit 18 Dec, 22 (23 Days); Skype 12 Dec, 22 (29 Days)
Call 05 Nov, 22 (66 Days); Visit 14 Dec, 22 (27 Days); Skype 01 Oct, 22 (100 Days)

My attempt: 'Days since the contact' can be calculated like this. Following will give the number of days:

Today() - DATEPARSE('dd MMM, yy','22 Dec, 22')

Now, how to use REGEXP_REPLACE() or some other functon to replace all these dates in a loop and replace them with the date+Number of days?


问:
Smooth firefox background gardient
I have noticed that a background gradient in Firefox is not so smooth rendered compared to chromium.

Firefox:

Chromium:

Firefox renders the gradient with more "artifacts" and not a homogeneous color fade.
Is there a way to smooth that, that the results looks as good as in chromium?

body{
    background-color: #2e3236;
    background-image: radial-gradient(circle, #4e505298 0, rgba(35, 40, 46, .5) 15%, #101418 95%);
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}```

Title: Smooth firefox background gardient


问:
How to automatically publish a GitHub Action to the Marketplace?
I'm trying to streamline and automate publishing of my Actions to the GitHub Actions Marketplace.

I'm quite confused about how GHA works. It doesn't behave the way I thought it would.

Here is one of such actions: https://github.com/UnlyEd/github-action-store-variable/releases

And there is the associated action on the GHA Marketplace: https://github.com/marketplace/actions/store-variables

The latest version on GitHub is 3.0.7, while the latest version on GHA Marketplace is 2.1.1.

The role of GHA is to act as an "index", nothing more. (I had been confused a while ago, thinking it was supposed to act similarly to NPM, see discussion)

Using GHA workflows, I automatically create tags and releases on GitHub, and I expect GHA Marketplace to reflect the "latest" version automatically. But, it doesn't.

When publishing manually, we have the option Publish this Action to the GitHub Marketplace, which makes me believe there is an option to also publish to the marketplace, and that it could be done automatically when creating a GitHub Release.

But, after looking for hours at different "Create GitHub Release" actions, such as https://github.com/marketplace/actions/create-release and https://github.com/softprops/action-gh-release, I couldn't find such option.

I have 2 different workflows for publishing:

Production

Staging (AKA "preview", "test", "beta", etc.)

For production, I want to automatically create a new tag (i.e: v3.1.2), a new GitHub Release, and publish it to GHA Marketplace. (see current workflow)

For staging, I want to automatically create a new tag (i.e: v3.1.2-rc.0), a new GitHub Release (marked as prerelease) and I don't want to publish it to the GHA Marketplace.(see current workflow)

Currently, tags and releases are created automatically and they work relatively well.
(I'm still encountering issues with special tags like latest, and generic major version tags like v3, but that's another issue)

But I couldn't find a way to automatically publish to GHA Marketplace. Must it be a manual step?


问:
The changes in my css files are no longer showing up on my django project
I am kind of new to django so someone please help me out. I'm building a blog app and so far everything's good but the new css rules I've added are not loading on my project. I've set up all my static files and older css rules are working, just the ones I added recently.
Here are the related files:

My template

```<code>{% extends "blog/base.html" %}
{% load static %}
{% block head %}
  <link href="{% static "blog/detail.css" %}" rel="stylesheet">
{% endblock head %}

{% block title%}{{ post.slug }}{% endblock %}

{% block content %}
  <div class="detail">
    <div class="head">
      <h1>{{ post.title }}</h1>
      <h2>{{ post.excerpt }}</h2>
    </div>
    <div class="post_image">
      <img src ="{{ post.image.url }}" alt="{{ post.title }}"/>
      <p>By {{post.author }} on {{ post.date }}</p>
    </div>
  </div>
  <div class="post_detail">
    <p>{{ post.content }}</p>
  </div>
  <div>
    <form id="comment_form">
      {% csrf_token %}
      {% for form_field in comment_form %}
        <div class="form-control">
          {{ form_field.label_tag }}
          {{ form_field }}
          {{ form_field.errors }}
        </div>
      {% endfor %}
      <button>Save Comment</button>
    </form>
  </div>
{% endblock %}
</code>```

And some of my settings.py

```<code>STATIC_URL = "/static/"
STATIC_ROOT = BASE_DIR / "static"
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "media"
</code>```

Body:
I am kind of new to django so someone please help me out. I'm building a blog app and so far everything's good but the new css rules I've added are not loading on my project. I've set up all my static files and older css rules are working, just the ones I added recently.
Here are the related files:

My template

{% extends "blog/base.html" %}
{% load static %}
{% block head %}
  <link href="{% static "blog/detail.css" %}" rel="stylesheet">
{% endblock head %}

{% block title%}{{ post.slug }}{% endblock %}

{% block content %}

{{ post.title }}

{{ post.excerpt }}

By {{post.author }} on {{ post.date }}

{{ post.content }}

    <form id="comment_form">
      {% csrf_token %}
      {% for form_field in comment_form %}

          {{ form_field.label_tag }}
          {{ form_field }}
          {{ form_field.errors }}

      {% endfor %}
      <button>Save Comment</button>
    </form>

{% endblock %}

And some of my settings.py

STATIC_URL = "/static/"
STATIC_ROOT = BASE_DIR / "static"
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "media"


问:
Angular lazy loading issue, loads whole module
I'm using lazy loading in angular projects with several modules.
I noticed that for some of those modules, there are no separate bundle being generated. It become part of the main bundle.

Would there be a case which cause the lazy loading to be broken and ends up loads the whole module ?

TIA


问:
how the transaction works in hotchoclate while batching the request?
/graphql?batch=[query1,query2] we can do the batching like this in hotchoclate. How the transaction and rollback happening like this approach?

Transaction and rollback should be happen


问:
Is it possible to show PostgreSQL terminal logs in Airflow Task log using just PostgresOperator?
I'm using the PostgresOperator to define tasks in Airflow. Today, i discovered that the PostgresSQL terminal logs such as 'raise notice' or information about number of rows affected didn't show up in the DAG's task log. It is possible to show them without using PythonOperator and launching SQL query from python?

I tried to put SQL query into $$ do block and raise some messages. I expect that this message from database terminal will be included in the task's log.


问:
Spawn NodeJS process inside packaged Electron app
How to spawn a NodeJS process inside a packaged electron app? (with electron-builder)
Somehow I have to provide the node binary, because there are some npm packages which use the binary in their scripts, like: "preinstall": "node ...", therefore I can't use the fork function. Is there any solution to access electron's node and use it for spawn?</p>


问:
SQL Query to processes customer table value for last six months transaction and add new columns flag and count based on processed value
`I have a customer table having columns

```<code>custname, value=> values(
x,  0011001,
y,  1100101,
z,  1111010,
a,  0111111)
</code>```

Question: Process customer table and add new columns flag and number of default transactions. 1 means successful transaction , 0 means default transaction from last 6 months in the cloumn value. Result should be like below.

```<code>custname,   value,  flag,   number=> values(
x,  0011001,    Y,  3,
Y,  1100101,    Y,  3,
Z,  1111010,    Y,  2,
A,  0111111,    N,  0)
</code>```

I have trying like below but not able to complete please suggest and help.

```<code>Alter table customer add flag VARCHAR 2, number INTEGER ;
UPDATE Table customer set flag = N  WHRE select value from customer)
SET NUMBER  = SELECT COUNT(VALUE) FROM CUSTOMER WEHRE`
</code>```

Body:
`I have a customer table having columns

custname, value=> values(
x,  0011001,
y,  1100101,
z,  1111010,
a,  0111111)

Question: Process customer table and add new columns flag and number of default transactions. 1 means successful transaction , 0 means default transaction from last 6 months in the cloumn value. Result should be like below.

custname,   value,  flag,   number=> values(
x,  0011001,    Y,  3,
Y,  1100101,    Y,  3,
Z,  1111010,    Y,  2,
A,  0111111,    N,  0)

I have trying like below but not able to complete please suggest and help.

Alter table customer add flag VARCHAR 2, number INTEGER ;
UPDATE Table customer set flag = N  WHRE select value from customer)
SET NUMBER  = SELECT COUNT(VALUE) FROM CUSTOMER WEHRE`


问:
Azure pipeline build failed due to missing assembly references
I have an windows service application which uses some third party packages hosted in pkgs.dev.azure.com. The application builds successfully in local but it continuously failing build in Azure pipeline. The errors are saying there are assembly reference missing for that third-party packages.

I investigated and got ensure that there's no authorization issue for that package source and restore package is done successfully in jobs. The project target framework in .NET 4.7.2. But I noticed that whenever I change the target framework to 4.6 in local, it gives the same error as in Azure pipeline build. Then I tried changing the vmimage from windows-latest to  windows-2019 in yaml file and also tried changing those packages' versions. But nothing's working. Can anyone please help me in this regard?


问:
twilio whatsapp sandbox does not automate replies

My Twilio sandbox does not automate replies with my python code, it was working previously, but now it isn't. Same code same method I used before, http request post = 200, no error it just not responds the regular setup with python.


问:
How do I create an 'irregular pentagon' with CSS3 but with a specific shape?
I'm trying to create a responsive image slider for a project I'm working at the moment.

The challenge is to shape the image slider with a particular shape from the brand.
It's basically a 'rectangle' with a corner cut and rounded border radius.

Here is an animated example of what I'm trying to achieve

As you can see on the snippet below, I have tried to re-create it using clip-path: path() method, however, the size is static and not responsive at all.

HTML/CSS Example:

section{
  width:100vw;
  height:100vh;
  display:flex;
  justify-content: center;
  align-items: center;
}

.slider-container{
   width: 90vw;
   height: 600px;
   background: #A490FF;
   clip-path: path('M0 30C0 13.4315 13.4315 0 30 0H1625C1641.57 0 1655 13.4315 1655 30V548C1655 564.569 1641.57 578 1625 578H333.043C324.531 578 316.201 575.531 309.064 570.892L9.10025 375.915C3.42439 372.226 0 365.916 0 359.146V30Z');
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><section>
  <div class="slider-container"></div>
</section></code>```

Thanks in advance for your help :)

Dzainr

Body:
I'm trying to create a responsive image slider for a project I'm working at the moment.

The challenge is to shape the image slider with a particular shape from the brand.
It's basically a 'rectangle' with a corner cut and rounded border radius.

Here is an animated example of what I'm trying to achieve

As you can see on the snippet below, I have tried to re-create it using clip-path: path() method, however, the size is static and not responsive at all.

HTML/CSS Example:

section{
  width:100vw;
  height:100vh;
  display:flex;
  justify-content: center;
  align-items: center;
}

.slider-container{
   width: 90vw;
   height: 600px;
   background: #A490FF;
   clip-path: path('M0 30C0 13.4315 13.4315 0 30 0H1625C1641.57 0 1655 13.4315 1655 30V548C1655 564.569 1641.57 578 1625 578H333.043C324.531 578 316.201 575.531 309.064 570.892L9.10025 375.915C3.42439 372.226 0 365.916 0 359.146V30Z');
}

Thanks in advance for your help :)

Dzainr


问:
Power BI: Dashboard refresh fails occasionally with error DM_GWPipeline_Gateway_MashupDataAccessError
I have uploaded my Power BI file in Power BI Service (Power BI online) and the source of this file is Azure Sql database and for the credentials of this database in Power Service I have set virtual network data gateways.

So the problem is that refreshing of the dataset fails occasionally, means sometimes it refreshes with no problem and everything work fine but sometimes the refresh fails with the error below.

And one more thing is that data refreshing in Power BI Desktop (while creating the dashboard) is ok and has no problem.

```<code>{
   "error":{
      "code":"DM_GWPipeline_Gateway_MashupDataAccessError",
      "pbi.error":{
         "code":"DM_GWPipeline_Gateway_MashupDataAccessError",
         "parameters":{

         },
         "details":[
            {
               "code":"DM_ErrorDetailNameCode_UnderlyingErrorCode",
               "detail":{
                  "type":1,
                  "value":"-2147467259"
               }
            },
            {
               "code":"DM_ErrorDetailNameCode_UnderlyingErrorMessage",
               "detail":{
                  "type":1,
                  "value":"An error happened while reading data from the provider: 'Invalid operation. The connection is closed.'"
               }
            },
            {
               "code":"DM_ErrorDetailNameCode_UnderlyingHResult",
               "detail":{
                  "type":1,
                  "value":"-2147467259"
               }
            },
            {
               "code":"Microsoft.Data.Mashup.ValueError.DataSourceKind",
               "detail":{
                  "type":1,
                  "value":"SQL"
               }
            },
            {
               "code":"Microsoft.Data.Mashup.ValueError.DataSourcePath",
               "detail":{
                  "type":1,
                  "value":"----------"
               }
            },
            {
               "code":"Microsoft.Data.Mashup.ValueError.Reason",
               "detail":{
                  "type":1,
                  "value":"DataSource.Error"
               }
            }
         ],
         "exceptionCulprit":1
      }
   }
} Table: ----------.
</code>```

{The ---------- is private information}

Searched internet to find a solution but there was no helpful one.
Changed the structure of the data model in Power BI Desktop didn't help

Body:
I have uploaded my Power BI file in Power BI Service (Power BI online) and the source of this file is Azure Sql database and for the credentials of this database in Power Service I have set virtual network data gateways.

So the problem is that refreshing of the dataset fails occasionally, means sometimes it refreshes with no problem and everything work fine but sometimes the refresh fails with the error below.

And one more thing is that data refreshing in Power BI Desktop (while creating the dashboard) is ok and has no problem.

{
   "error":{
      "code":"DM_GWPipeline_Gateway_MashupDataAccessError",
      "pbi.error":{
         "code":"DM_GWPipeline_Gateway_MashupDataAccessError",
         "parameters":{

         },
         "details":[
            {
               "code":"DM_ErrorDetailNameCode_UnderlyingErrorCode",
               "detail":{
                  "type":1,
                  "value":"-2147467259"
               }
            },
            {
               "code":"DM_ErrorDetailNameCode_UnderlyingErrorMessage",
               "detail":{
                  "type":1,
                  "value":"An error happened while reading data from the provider: 'Invalid operation. The connection is closed.'"
               }
            },
            {
               "code":"DM_ErrorDetailNameCode_UnderlyingHResult",
               "detail":{
                  "type":1,
                  "value":"-2147467259"
               }
            },
            {
               "code":"Microsoft.Data.Mashup.ValueError.DataSourceKind",
               "detail":{
                  "type":1,
                  "value":"SQL"
               }
            },
            {
               "code":"Microsoft.Data.Mashup.ValueError.DataSourcePath",
               "detail":{
                  "type":1,
                  "value":"----------"
               }
            },
            {
               "code":"Microsoft.Data.Mashup.ValueError.Reason",
               "detail":{
                  "type":1,
                  "value":"DataSource.Error"
               }
            }
         ],
         "exceptionCulprit":1
      }
   }
} Table: ----------.

{The ---------- is private information}

Searched internet to find a solution but there was no helpful one.
Changed the structure of the data model in Power BI Desktop didn't help


问:
I want to stay on dashboard if local storage has access token and redirect to login if not
I am doing it but page continues to refresh as i have local storage token. Its JS that i am using for it.
[![Here is the image i dont want to get back to login page if there is token in local storage][1]][1]
[1]: https://i.stack.imgur.com/IwtcP.png
So here is the full code and this is working fine all i need is to set the check if the token is present in local storage then stay otherwise get back to login page

```<code><html lang="en" style="height: auto;"><head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>AdminLTE 3 | DataTables</title>

    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <link rel="stylesheet" href="/assets/plugins/fontawesome-free/css/all.min.css">
    <link rel="stylesheet" href="/assets/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
    <link rel="stylesheet" href="/assets/plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
    <link rel="stylesheet" href="/assets/plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
    <link rel="stylesheet" href="/assets/dist/css/adminlte.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.2.1/axios.js"integrity="sha512-SXo2rCaEJmbAPoxtaSjW+/hLaVCMAJ1CX8XnIP02x6/LIaWQp4GipKxQhBwL8Tn5U/K+lD9AaM4f4mXJdKnDQw=="crossorigin="anonymous"referrerpolicy="no-referrer"></script>
    <script src="https://kit.fontawesome.com/9f98b6568d.js" crossorigin="anonymous"></script>
  </head>
  <body >
  <div class="wrapper">
    <nav class="main-header navbar navbar-expand navbar-white navbar-light ml-0 ">
      <ul class="navbar-nav">
        <li class="nav-item">

        </li>
        <li class="nav-item d-none d-sm-inline-block">
          <a href="/admin/view_hotels" class="nav-link">View Hotels</a>
        </li>
        <li class="nav-item d-none d-sm-inline-block">
          <a href="/add/hotels" class="nav-link">Add Hotels</a>
        </li>
        <li class="nav-item d-none d-sm-inline-block">
          <a href="https://thewordyboy.com/gift-store-about-us/" class="nav-link">About Us</a>
        </li>
      </ul>

      <ul class="navbar-nav ml-auto">

        <li class="nav-item">

        </li>
        <li class="nav-item">
          <a class="nav-link" onclick="logout();" role="button">
            <i class="fa-solid fa-arrow-right-from-bracket "></i>
          </a>
        </li>
      </ul>
    </nav>

    <div class="content-wrapper ml-0" style="min-height: 2080.12px;">
      <section class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6">
              <h1>DataTables</h1>
            </div>
            <div class="col-sm-6">
              <ol class="breadcrumb float-sm-right">
              </ol>
            </div>
          </div>
        </div>
      </section>

      <!-- Main content -->
      <section class="content">
        <div class="container-fluid">
          <div class="row">
            <div class="col-12">
              <div class="card">
                <div class="card-header">
                  <h3 class="card-title">DataTable with minimal features & hover style</h3>
                </div>
                <!-- /.card-header -->
                <div class="card-body">
                  <div><div class="row"><div class="col-sm-12 col-md-6"></div><div class="col-sm-12 col-md-6"></div></div><div class="row"><div class="col-sm-12"><table  class="table table-bordered table-hover dataTable dtr-inline" role="grid">
                    <thead>
                    <tr role="row"><th>Id</th><th >Name</th><th >Email</th><th>Password</th><th>Retype</th><th>Contact</th><th>Actions</th></tr>
                    </thead>
                    <tbody id="data">
                      <script>

  axios
    .get(
      "https://localhost:8000/allusers")
    .then((response) => {
      console.log(response.data)
      for (let i = 0; i < response.data.length; i++) {
              document.getElementById('data').innerHTML+=`<tr class="odd">
                      <td class="dtr-control sorting_1" tabindex="0">${response.data[i].id}</td>
                      <td>${response.data[i].name}</td>
                      <td>${response.data[i].email}</td>
                      <td>${response.data[i].password}</td>
                      <td>${response.data[i].cpassword}</td>
                      <td >${response.data[i].contact}</td>
                      <td ><a href="/user/delete/${response.data[i].id}"><button class="btn btn-danger">Delete</button></a><a href='/user/update?id=${response.data[i].id}&name=${response.data[i].name}&email=${response.data[i].email}&password=${response.data[i].password}&retype=${response.data[i].cpassword}&contact=${response.data[i].contact}'><button class="btn btn-primary ml-3">Update</button></a></td>
                      `
      }

  })

    .catch((error) => {
      console.log(error);
    });

                      </script>

                  </tbody>
                  </table>
                </div>
              </div>

              <div class="card">

              </div>
            </div>
          </div>
        </div>
      </section>
    </div>
    <!-- /.content-wrapper -->
    <footer class="main-footer">
      <div class="float-right d-none d-sm-block">
        <b>Version</b> 3.1.0
      </div>
      <strong>Copyright © 2014-2021 <a href="https://adminlte.io">AdminLTE.io</a>.</strong> All rights reserved.
    </footer>

    <!-- Control Sidebar -->

    <!-- /.control-sidebar -->
  </div>
  <!-- ./wrapper -->

  <!-- jQuery -->
  <script src="/assets/plugins/jquery/jquery.min.js"></script>
  <!-- Bootstrap 4 -->
  <script src="/assets/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="/assets/plugins/datatables/jquery.dataTables.min.js"></script>
  <script src="/assets/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
  <script src="/assets/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
  <script src="/assets/plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
  <script src="/assets/plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
  <script src="/assets/plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
  <script src="/assets/plugins/jszip/jszip.min.js"></script>
  <script src="/assets/plugins/pdfmake/pdfmake.min.js"></script>
  <script src="/assets/plugins/pdfmake/vfs_fonts.js"></script>
  <script src="/assets/plugins/datatables-buttons/js/buttons.html5.min.js"></script>
  <script src="/assets/plugins/datatables-buttons/js/buttons.print.min.js"></script>
  <script src="/assets/plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
  <!-- AdminLTE App -->
  <script src="/assets/dist/js/adminlte.min.js"></script>

  <script>
    $(function () {
      $('#example2').DataTable({
        "paging": false,
        "lengthChange": false,
        "searching": false,
        "ordering": false,
        "info": false,
        "autoWidth": false,
        "responsive": false,
      });
    });
  </script>
  <script>
 const data=localStorage.getItem('token')
 if(data===null)
 {
  window.location.href='/login'
 }
 else{

 }

    function logout(){
      console.log(localStorage.getItem('token'))
      axios
    .get(
      "https://localhost:8000/logout",{
        headers: { Authorization:localStorage.getItem('token') }
      })
    .then((response) => {
      window.location.href='/login'
    })
    }
  </script>

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

login.html

```<code><html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>AdminLTE 3 | Log in</title>

    <link
      rel="stylesheet"
      href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback"
    />
    <link
      rel="stylesheet"
      href="/assets/plugins/fontawesome-free/css/all.min.css"
    />
    <link
      rel="stylesheet"
      href="/assets/plugins/icheck-bootstrap/icheck-bootstrap.min.css"
    />
    <link rel="stylesheet" href="/assets/dist/css/adminlte.min.css" />
  </head>
  <body class="login-page" style="min-height: 496.781px">
    <div class="login-box">
      <div class="login-logo">
        <a href="/assets/index2.html"><b>Admin</b>LTE</a>
      </div>
      <div class="card">
        <div class="card-body login-card-body">
          <p class="login-box-msg">Sign in to start your session</p>

          <div class="input-group mb-3">
            <input
              type="email"
              class="form-control"
              placeholder="Email"
              name="email"
              id="email"
            />
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-envelope"></span>
              </div>
            </div>
          </div>
          <div class="input-group mb-3">
            <input
              type="password"
              class="form-control"
              placeholder="Password"
              name="password"
              id="password"
            />
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-lock"></span>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-8">
              <div class="icheck-primary">
                <input type="checkbox" id="remember" />
                <label for="remember"> Remember Me </label>
              </div>
            </div>
            <div class="col-4">
              <button onclick="login()" class="btn btn-primary btn-block">
                Sign In
              </button>
            </div>
          </div>

          <p class="mb-1">
            <a href="forgot-password.html">I forgot my password</a>
          </p>
          <p class="mb-0">
            <a href="register.html" class="text-center">
              Register a new membership</a
            >
          </p>
        </div>
      </div>
    </div>

    </div>
    <div class="w-100 h-100" id="demo">

    <script src="/assets/plugins/jquery/jquery.min.js"></script>
    <script src="/assets/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
    <script src="/assets/dist/js/adminlte.min.js"></script>
    <script
      src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.2.1/axios.js"
      integrity="sha512-SXo2rCaEJmbAPoxtaSjW+/hLaVCMAJ1CX8XnIP02x6/LIaWQp4GipKxQhBwL8Tn5U/K+lD9AaM4f4mXJdKnDQw=="
      crossorigin="anonymous"
      referrerpolicy="no-referrer"
    ></script>
    <script>
          function login() {

            axios
              .post(
                "https://localhost:8000/login",
                {
                  email: document.getElementById('email').value,
                  password: document.getElementById('password').value,
                },
                {
                  headers: {'Content-Type': 'application/json'}
                }
              )
              .then((response) => {
              localStorage.setItem('token',response.data.token);
              console.log(localStorage.getItem('token'))
                 if(localStorage.getItem('token')!=='undefined' ){
                  if(response.data.data==='f180111@nu.edu.pk'){
                    window.location.href="/dashboard"
                  }
                  else{
                    window.location.href="/userDashboard"
                  }

                 }
                 else{
                  window.location.href="/signup"
                 }
          })
        }
    </script>
  </body>
</html>
</code>```

Body:
I am doing it but page continues to refresh as i have local storage token. Its JS that i am using for it.
[![Here is the image i dont want to get back to login page if there is token in local storage][1]][1]
[1]: https://i.stack.imgur.com/IwtcP.png
So here is the full code and this is working fine all i need is to set the check if the token is present in local storage then stay otherwise get back to login page

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>AdminLTE 3 | DataTables</title>

    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <link rel="stylesheet" href="/assets/plugins/fontawesome-free/css/all.min.css">
    <link rel="stylesheet" href="/assets/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
    <link rel="stylesheet" href="/assets/plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
    <link rel="stylesheet" href="/assets/plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
    <link rel="stylesheet" href="/assets/dist/css/adminlte.min.css">

          View Hotels

          Add Hotels

          About Us

DataTables

DataTable with minimal features & hover style

Id	Name	Email	Password	Retype	Contact	Actions

        Version 3.1.0

      Copyright © 2014-2021 AdminLTE.io. All rights reserved.

login.html

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>AdminLTE 3 | Log in</title>

    <link
      rel="stylesheet"
      href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback"
    />
    <link
      rel="stylesheet"
      href="/assets/plugins/fontawesome-free/css/all.min.css"
    />
    <link
      rel="stylesheet"
      href="/assets/plugins/icheck-bootstrap/icheck-bootstrap.min.css"
    />
    <link rel="stylesheet" href="/assets/dist/css/adminlte.min.css" />

        AdminLTE

Sign in to start your session

            <input
              type="email"
              class="form-control"
              placeholder="Email"
              name="email"
              id="email"
            />

            <input
              type="password"
              class="form-control"
              placeholder="Password"
              name="password"
              id="password"
            />

                <input type="checkbox" id="remember" />
                 Remember Me

              <button onclick="login()" class="btn btn-primary btn-block">
                Sign In
              </button>

            I forgot my password

              Register a new membership


问:
KivyMd elements are displayed below element card
I am using KivyMd for app design and my title for button and icon are displayed below element card.No name of elements are displayed
I know they are below as on changing size, characters are visible.Character visible when resized.. Moreover images are still not visible.

Here is a part of my code for Element card


问:
Flutter fetch data from Api and save in sqlite
Hello friends i am fetching data from Api and saving it sqlite my issue is that i need check  if data is already saved in sqlite then it just return true value otherwise return false.i want implement favourite feature in my app please look at my code and tell me.i am trying searching number article and also on youtube but unable to find answer any expert know how handle this issue

```<code> import 'package:flutter/cupertino.dart';
    import 'package:flutter/material.dart';
    import 'package:fluttertoast/fluttertoast.dart';
    import 'package:livinghopegeetzaboor/Db/Databasehelper.dart';
    import 'package:livinghopegeetzaboor/Statemanagment/Library/Librarychildprovider.dart';
    import 'package:livinghopegeetzaboor/constant/AppColor.dart';
    import 'package:livinghopegeetzaboor/model/Favourite/Favouritemodel.dart';
    import 'package:livinghopegeetzaboor/model/Library/Librarychildmodel.dart';
    import 'package:livinghopegeetzaboor/sacreen/Pdfsacreen/Allpdf.dart';
    import 'package:provider/provider.dart';
        class Geetpdflist extends StatefulWidget {
        var id;
          @override
          State<Geetpdflist> createState() => _GeetpdflistState();
        Geetpdflist({this.id});
        }
        class _GeetpdflistState extends State<Geetpdflist> {
          Databasehelper databasehelper=Databasehelper();
          List favouritelist = [];  //here is data coming from favourite table sqflite
        @override
          void initState() {
            // TODO: implement initState
            super.initState();
            WidgetsBinding.instance.addPostFrameCallback((_){
              Provider.of<Librarychildprovider>(context,listen: false).fetchlibarychild(widget.id);
              // Add Your Code here.
            });
           getfavourite();
          }
          void getfavourite() async {
            final data = await databasehelper.favouirte();
              favouritelist = data;
          }
          @override
          Widget build(BuildContext context) {
            return Scaffold(
            appBar: AppBar(
              iconTheme: IconThemeData(
                color: AppColor.color, //change your color here
              ),
              title:Text('Geet & Zaboor',style: TextStyle(
                fontSize: 19,
                    color: Colors.black
              ),) ,
              elevation: 0.0,
               backgroundColor: AppColor.appbarcolor,
              centerTitle: true,
           ),
              body:Column(
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  Padding(
                    padding: EdgeInsets.all(40),
                    child:Container(
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(20.0),
                        color: AppColor.color,
                      ),
                      height: 80,
                      child: Padding(
                        padding: EdgeInsets.all(8.0),
                        child: Row(
                          children: [
                            Expanded(
                              child: TextField(
                                decoration: InputDecoration(
                                  enabledBorder:  OutlineInputBorder(
                                    borderSide: const BorderSide(color: Colors.white, width:2),
                                  ),
                                  filled: true, //<-- SEE HERE
                                  fillColor: Colors.white,
                                  border: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(20),
                                  ),
                                  hintText: 'Search for any songs',
                                ),
                              ),
                            ),
                            SizedBox(width: 3,),
                            Container(
                              height: 59,
                              width: 59,
                              color:Colors.white,
                              constraints: const BoxConstraints(
                              ),
                              child: Icon(
                                Icons.search_sharp,
                                size: 40,
                                color: AppColor.color,
                              ),
                            )
                          ],
                        ),
                      ),
                    ),
                  ),
                  Consumer<Librarychildprovider>(
                  builder:(BuildContext context, value, Widget? child) {
                  if(value.isloading){
                    return CircularProgressIndicator(
                      color: AppColor.color,
                    );
                  }else{
                    return ListView.builder(
                        itemCount: value.librarychild.length,
                        shrinkWrap: true,
                        itemBuilder: (contex,index){
                          String file=value.librarychild[index].name.toString(); //this api data
 //i need check if Api is data is already in sqlite light then return true
                          return Card(
                            child: ListTile(
                              trailing: IconButton(
                                icon: Icon(
                                    Icons.star
                                ), onPressed: () {
                                  databasehelper.insert(
                                    Favouritemodel(id: index, name: value.librarychild[index].name, file: value.librarychild[index].file)
                                  );
                              },
                              ) ,
                              leading:  Icon(Icons.library_books),
                              title: GestureDetector(
                                onTap: (){
                                  Navigator.push(
                                    context,
                                    MaterialPageRoute(builder: (context) => Allpdf(url: value.librarychild[index].file,)),
                                  );
                                },
                                child: Text(value.librarychild[index].name.toString(),style: TextStyle(
                                    fontSize: 18
                                ),),
                              ),
                            ),
                          );
                        });
                  }
            }
                  )
                ],
              ),
            );
          }
        }

import 'dart:io' as io;
import 'package:livinghopegeetzaboor/model/Favourite/Favouritemodel.dart';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
import 'package:path_provider/path_provider.dart';

class Databasehelper{
  static Database? _db;

  Future<Database?> get db async {
    if(_db != null)
      return _db;
    _db = await initDb();
    return _db;
  }

  //Creating a database with name test.dn in your directory
  initDb() async {
    io.Directory documentsDirectory = await getApplicationDocumentsDirectory();
    String path = join(documentsDirectory.path, "favourite.db");
    var theDb = await openDatabase(path, version: 1, onCreate: _onCreate);
    return theDb;
  }

  // Creating a table
  void _onCreate(Database db, int version) async {
    // When creating the db, create the table
    await db.execute(
        "CREATE TABLE favourite(id INTEGER PRIMARY KEY, name TEXT, file  TEXT  unique )");
    print("Created tables");
  }
  //insert data
  Future<Favouritemodel> insert(Favouritemodel favouritemodel) async {
    Database? db = await this.db;
   await db!.insert('favourite', favouritemodel.toJson());
   return favouritemodel;
  }

  Future<List<Map<String, dynamic>>> favouirte() async {
    Database? db = await this.db;
    return db!.query('favourite');
  }
</code>```

}

Body:
Hello friends i am fetching data from Api and saving it sqlite my issue is that i need check  if data is already saved in sqlite then it just return true value otherwise return false.i want implement favourite feature in my app please look at my code and tell me.i am trying searching number article and also on youtube but unable to find answer any expert know how handle this issue

 import 'package:flutter/cupertino.dart';
    import 'package:flutter/material.dart';
    import 'package:fluttertoast/fluttertoast.dart';
    import 'package:livinghopegeetzaboor/Db/Databasehelper.dart';
    import 'package:livinghopegeetzaboor/Statemanagment/Library/Librarychildprovider.dart';
    import 'package:livinghopegeetzaboor/constant/AppColor.dart';
    import 'package:livinghopegeetzaboor/model/Favourite/Favouritemodel.dart';
    import 'package:livinghopegeetzaboor/model/Library/Librarychildmodel.dart';
    import 'package:livinghopegeetzaboor/sacreen/Pdfsacreen/Allpdf.dart';
    import 'package:provider/provider.dart';
        class Geetpdflist extends StatefulWidget {
        var id;
          @override
          State<Geetpdflist> createState() => _GeetpdflistState();
        Geetpdflist({this.id});
        }
        class _GeetpdflistState extends State<Geetpdflist> {
          Databasehelper databasehelper=Databasehelper();
          List favouritelist = [];  //here is data coming from favourite table sqflite
        @override
          void initState() {
            // TODO: implement initState
            super.initState();
            WidgetsBinding.instance.addPostFrameCallback((_){
              Provider.of<Librarychildprovider>(context,listen: false).fetchlibarychild(widget.id);
              // Add Your Code here.
            });
           getfavourite();
          }
          void getfavourite() async {
            final data = await databasehelper.favouirte();
              favouritelist = data;
          }
          @override
          Widget build(BuildContext context) {
            return Scaffold(
            appBar: AppBar(
              iconTheme: IconThemeData(
                color: AppColor.color, //change your color here
              ),
              title:Text('Geet & Zaboor',style: TextStyle(
                fontSize: 19,
                    color: Colors.black
              ),) ,
              elevation: 0.0,
               backgroundColor: AppColor.appbarcolor,
              centerTitle: true,
           ),
              body:Column(
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  Padding(
                    padding: EdgeInsets.all(40),
                    child:Container(
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(20.0),
                        color: AppColor.color,
                      ),
                      height: 80,
                      child: Padding(
                        padding: EdgeInsets.all(8.0),
                        child: Row(
                          children: [
                            Expanded(
                              child: TextField(
                                decoration: InputDecoration(
                                  enabledBorder:  OutlineInputBorder(
                                    borderSide: const BorderSide(color: Colors.white, width:2),
                                  ),
                                  filled: true, //<-- SEE HERE
                                  fillColor: Colors.white,
                                  border: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(20),
                                  ),
                                  hintText: 'Search for any songs',
                                ),
                              ),
                            ),
                            SizedBox(width: 3,),
                            Container(
                              height: 59,
                              width: 59,
                              color:Colors.white,
                              constraints: const BoxConstraints(
                              ),
                              child: Icon(
                                Icons.search_sharp,
                                size: 40,
                                color: AppColor.color,
                              ),
                            )
                          ],
                        ),
                      ),
                    ),
                  ),
                  Consumer<Librarychildprovider>(
                  builder:(BuildContext context, value, Widget? child) {
                  if(value.isloading){
                    return CircularProgressIndicator(
                      color: AppColor.color,
                    );
                  }else{
                    return ListView.builder(
                        itemCount: value.librarychild.length,
                        shrinkWrap: true,
                        itemBuilder: (contex,index){
                          String file=value.librarychild[index].name.toString(); //this api data
 //i need check if Api is data is already in sqlite light then return true
                          return Card(
                            child: ListTile(
                              trailing: IconButton(
                                icon: Icon(
                                    Icons.star
                                ), onPressed: () {
                                  databasehelper.insert(
                                    Favouritemodel(id: index, name: value.librarychild[index].name, file: value.librarychild[index].file)
                                  );
                              },
                              ) ,
                              leading:  Icon(Icons.library_books),
                              title: GestureDetector(
                                onTap: (){
                                  Navigator.push(
                                    context,
                                    MaterialPageRoute(builder: (context) => Allpdf(url: value.librarychild[index].file,)),
                                  );
                                },
                                child: Text(value.librarychild[index].name.toString(),style: TextStyle(
                                    fontSize: 18
                                ),),
                              ),
                            ),
                          );
                        });
                  }
            }
                  )
                ],
              ),
            );
          }
        }

import 'dart:io' as io;
import 'package:livinghopegeetzaboor/model/Favourite/Favouritemodel.dart';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
import 'package:path_provider/path_provider.dart';

class Databasehelper{
  static Database? _db;

  Future<Database?> get db async {
    if(_db != null)
      return _db;
    _db = await initDb();
    return _db;
  }

  //Creating a database with name test.dn in your directory
  initDb() async {
    io.Directory documentsDirectory = await getApplicationDocumentsDirectory();
    String path = join(documentsDirectory.path, "favourite.db");
    var theDb = await openDatabase(path, version: 1, onCreate: _onCreate);
    return theDb;
  }

  // Creating a table
  void _onCreate(Database db, int version) async {
    // When creating the db, create the table
    await db.execute(
        "CREATE TABLE favourite(id INTEGER PRIMARY KEY, name TEXT, file  TEXT  unique )");
    print("Created tables");
  }
  //insert data
  Future<Favouritemodel> insert(Favouritemodel favouritemodel) async {
    Database? db = await this.db;
   await db!.insert('favourite', favouritemodel.toJson());
   return favouritemodel;
  }

  Future<List<Map<String, dynamic>>> favouirte() async {
    Database? db = await this.db;
    return db!.query('favourite');
  }

}


问:
st_union error: deprecated C function 'pgis_geometry_union_finalfn'
I have a database on Heroku with Postgis installed. My system relies heavily on geometric operations such as st_union. I guess Heroku updated my postgis version recently and now all my queries that use functions like st_union or st_overlap produce this error:

```<code>[0A000] ERROR: A stored procedure tried to use deprecated C function 'pgis_geometry_union_finalfn' Detail: Library function 'pgis_geometry_union_finalfn' was deprecated in PostGIS 3.3.0 Hint: Consider running: SELECT postgis_extensions_upgrade()
</code>```

Is this correct? Have these functions been removed? Are there alternative functions?

I am running Postgis version 3.3.2 and Postgres version 14.6

Body:
I have a database on Heroku with Postgis installed. My system relies heavily on geometric operations such as st_union. I guess Heroku updated my postgis version recently and now all my queries that use functions like st_union or st_overlap produce this error:

[0A000] ERROR: A stored procedure tried to use deprecated C function 'pgis_geometry_union_finalfn' Detail: Library function 'pgis_geometry_union_finalfn' was deprecated in PostGIS 3.3.0 Hint: Consider running: SELECT postgis_extensions_upgrade()

Is this correct? Have these functions been removed? Are there alternative functions?

I am running Postgis version 3.3.2 and Postgres version 14.6


问:
How do I write a plugin to get the account creation date, total number of users & total number of licensed users in Jenkins?
I am trying to write a plugin for Jenkins to get the account creation date, total number of users, and total number of licensed users. I am having difficulty understanding how I can access the necessary data and create the plugin to display the required information. I tried searching for a solution, but I couldn't find one.

I've tried something like this:

import hudson.model.User;

String user = User.current();
String mailAddress = user.getMailAddress();
```

Is there a way to get the same thing mentioned above?

Body:
I am trying to write a plugin for Jenkins to get the account creation date, total number of users, and total number of licensed users. I am having difficulty understanding how I can access the necessary data and create the plugin to display the required information. I tried searching for a solution, but I couldn't find one.

I've tried something like this:

import hudson.model.User;

String user = User.current();
String mailAddress = user.getMailAddress();

Is there a way to get the same thing mentioned above?


问:
Arithmetic Addition
I am trying to do Addition on two register. It show result Correctly until the result of addition is less than 20. As the result goes above 20. Program is displaying garbage values:

Here is the code

```<code>mov ax, 10
mov bx, 9

add ax, bx
aaa
mov bx, ax

add bl, 48
add bh, 48

mov ah, 02
mov dl, bh
int 21h

mov ah, 02
mov dl, bl
int 21h
</code>```

What I am doing wrong? :' (

Title: Arithmetic Addition

Body:
I am trying to do Addition on two register. It show result Correctly until the result of addition is less than 20. As the result goes above 20. Program is displaying garbage values:

Here is the code

mov ax, 10
mov bx, 9

add ax, bx
aaa
mov bx, ax

add bl, 48
add bh, 48

mov ah, 02
mov dl, bh
int 21h

mov ah, 02
mov dl, bl
int 21h

What I am doing wrong? :' (


问:
Is it a good practice to annotate beans inside a custom library with @Component or @Service in Spring Boot?
I am creating a Spring Boot library which can be used for my main projects. Is it not a good practice to annotate beans inside a custom library with @Component or @Service in Spring Boot? If so, why?

Because I saw an article saying,

Do not annotate each of your beans inside a library with @Component or
@Service, but define them in an auto-configured module.

But I have 2 classes which I annotated as @Service and inside those 2 classes they have some beans configured as follows,

```<code>@Service
public class SomeClass {

private @Autowired SomeClient client;

@Bean
public SomeClient client(@Value("${some.param}) String key) {
   return new SomeClient(key);
}

public void use() {
   // use the @Autowired client and do a task
}
}
</code>```

When I used this library as a dependency in my main project it is working fine. But I need to know what is the best practice since that article says not to do this. But if I have to configure these inside AutoConfiguration class it's tedious. So can anyone guide me to the correct path? Thank you.

Body:
I am creating a Spring Boot library which can be used for my main projects. Is it not a good practice to annotate beans inside a custom library with @Component or @Service in Spring Boot? If so, why?

Because I saw an article saying,

Do not annotate each of your beans inside a library with @Component or
@Service, but define them in an auto-configured module.

But I have 2 classes which I annotated as @Service and inside those 2 classes they have some beans configured as follows,

@Service
public class SomeClass {

private @Autowired SomeClient client;

@Bean
public SomeClient client(@Value("${some.param}) String key) {
   return new SomeClient(key);
}

public void use() {
   // use the @Autowired client and do a task
}
}

When I used this library as a dependency in my main project it is working fine. But I need to know what is the best practice since that article says not to do this. But if I have to configure these inside AutoConfiguration class it's tedious. So can anyone guide me to the correct path? Thank you.