问:
Selenium MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError
```<code>class gmarket_sales():

    def __init__(self):

        chrome_driver = Service(ChromeDriverManager().install())
        options = Options()
        options.add_experimental_option('detach',True)
        options.add_experimental_option('excludeSwitches',['enable-logging'])
        # options.add_argument('--headless')
        # options.add_argument('--window-size = x, y')
        # options.add_argument('--start-maximazed')
        # options.add_argument('--start-fullscreen')
        # options.add_argument('--mute-audio')
        self.driver = webdriver.Chrome(options=options,service=chrome_driver)
        self.now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S (%a)')
        self.hour = datetime.datetime.now().strftime('%H시_%M_분')
        self.today = date.today()
        self.folder = None
        self.today_file = None
        self.kakao_talk = kakao()

    def connect(self):
        url = 'http://minishop.gmarket.co.kr/meritblog'
        # url = 'http://minishop.gmarket.co.kr/hanvitis'
        self.driver.get(url)

        return url

    def shopping_mall(self):
        mall_name = self.driver.find_element(By.CSS_SELECTOR,'a.shop_title_ui_txt').text

        self.folder = f'./메리트몰_데이터베이스/지마켓'
        self.today_file = f'{self.today}_{mall_name}_지마켓.json'

        return mall_name

    def soup(self,url_param):

        try:
            response = requests.get(url_param)
            if response.status_code == 200:
                sp = BeautifulSoup(response.text, 'html.parser')

            return sp
        except requests.packages.urllib3.exceptions.MaxRetryError as e:
           print(str(e))

    def total_product(self):

        total_items = 0

        products = self.driver.find_element(By.ID,'ulCategory').find_elements(By.CSS_SELECTOR,'span.data_num')
        for product in products:
            items = int(product.text.replace('(',"").replace(')',""))
            total_items += items

        # 391개
        return total_items

    def paging(self,total_items,url):

        page_list = []

        # 전체상품보기 클릭
        self.driver.execute_script('arguments[0].click();',self.driver.find_element(By.CSS_SELECTOR,'.allList_view > a'))
        time.sleep(2)

        # 한 페이지의 상품 수
        view_limit = int(self.driver.find_element(By.CSS_SELECTOR,'div.limit').text.replace("개씩",""))

        # 페이지 수 구하기
        if total_items % view_limit == 0:
            page = total_items // view_limit
        else:
            page = total_items // view_limit + 1

        # 페이지 리스트
        for cnt in range(page):
            page_url = f'{url}/List?CategoryType=General&SortType=FocusRank&DisplayType=SmallImage&Page={cnt+1}&PageSize=60'
            page_list.append(page_url)

        # self.driver.quit()

        return page_list

    def data_one(self,page_list):
        """상품 url 리스트
        정상가/할인가/할인율 딕셔너리"""

        url_list = []
        price_dic = {}

        for page in page_list:
            html = self.soup(page)
            for items in html.find('ul',class_='type2').find_all('li'):

                # url
                item_url = items.find('a')['href']

                # 상품코드
                item_code = item_url[-10:]

                # 가격 및 할인율
                if items.find('p',class_='prd_price').find('span',class_='del_important'):
                    original_price = items.find('p',class_='prd_price').find('span',class_='del_important').text.replace("원","")
                    discount_price = items.find('p',class_='prd_price').find('strong').text.replace("원","")
                    sale_rate = items.find('p',class_='prd_price').find('span',class_='splt_ico usr_clr').text

                else:
                    original_price = items.find('p',class_='prd_price').find('strong').text.replace("원","")
                    discount_price = "없음"
                    sale_rate = "없음"

                url_list.append(item_url)

                price_dic[item_code]={"정상가":original_price,"할인가":discount_price,"할인율":sale_rate}

            time.sleep(randint(1,10))

        self.driver.quit()

        return url_list , price_dic

    def check_start(self):

        url = self.connect()
        mall_name = self.shopping_mall()
        total_items = self.total_product()
        page_list = self.paging(total_items,url)
        url_list,price_dic = self.data_one(page_list)

if __name__ == "__main__":

    g_market = gmarket_sales()

    # g_market.check_start()

    schedule.every().hour.at(":20").do(g_market.check_start)

    while True:
        schedule.run_pending()
        time.sleep(1)
</code>```

Hello, I am a student practicing web page crawling.
I'm making a code that scrapes data by parsing a website with selenium.

I wrote the program so that it runs at regular intervals using the final schedule module.
However, if chrome_driver is initialized in the init of the class and the driver.quit() command is put in the execution process, the MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError code is displayed when the second code is executed..

Below is the code I wrote.
I would really appreciate it if you could point out any problems.

Body:
class gmarket_sales():

    def __init__(self):

        chrome_driver = Service(ChromeDriverManager().install())
        options = Options()
        options.add_experimental_option('detach',True)
        options.add_experimental_option('excludeSwitches',['enable-logging'])
        # options.add_argument('--headless')
        # options.add_argument('--window-size = x, y')
        # options.add_argument('--start-maximazed')
        # options.add_argument('--start-fullscreen')
        # options.add_argument('--mute-audio')
        self.driver = webdriver.Chrome(options=options,service=chrome_driver)
        self.now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S (%a)')
        self.hour = datetime.datetime.now().strftime('%H시_%M_분')
        self.today = date.today()
        self.folder = None
        self.today_file = None
        self.kakao_talk = kakao()

    def connect(self):
        url = 'http://minishop.gmarket.co.kr/meritblog'
        # url = 'http://minishop.gmarket.co.kr/hanvitis'
        self.driver.get(url)

        return url

    def shopping_mall(self):
        mall_name = self.driver.find_element(By.CSS_SELECTOR,'a.shop_title_ui_txt').text

        self.folder = f'./메리트몰_데이터베이스/지마켓'
        self.today_file = f'{self.today}_{mall_name}_지마켓.json'

        return mall_name

    def soup(self,url_param):

        try:
            response = requests.get(url_param)
            if response.status_code == 200:
                sp = BeautifulSoup(response.text, 'html.parser')

            return sp
        except requests.packages.urllib3.exceptions.MaxRetryError as e:
           print(str(e))

    def total_product(self):

        total_items = 0

        products = self.driver.find_element(By.ID,'ulCategory').find_elements(By.CSS_SELECTOR,'span.data_num')
        for product in products:
            items = int(product.text.replace('(',"").replace(')',""))
            total_items += items

        # 391개
        return total_items

    def paging(self,total_items,url):

        page_list = []

        # 전체상품보기 클릭
        self.driver.execute_script('arguments[0].click();',self.driver.find_element(By.CSS_SELECTOR,'.allList_view > a'))
        time.sleep(2)

        # 한 페이지의 상품 수
        view_limit = int(self.driver.find_element(By.CSS_SELECTOR,'div.limit').text.replace("개씩",""))

        # 페이지 수 구하기
        if total_items % view_limit == 0:
            page = total_items // view_limit
        else:
            page = total_items // view_limit + 1

        # 페이지 리스트
        for cnt in range(page):
            page_url = f'{url}/List?CategoryType=General&SortType=FocusRank&DisplayType=SmallImage&Page={cnt+1}&PageSize=60'
            page_list.append(page_url)

        # self.driver.quit()

        return page_list

    def data_one(self,page_list):
        """상품 url 리스트
        정상가/할인가/할인율 딕셔너리"""

        url_list = []
        price_dic = {}

        for page in page_list:
            html = self.soup(page)
            for items in html.find('ul',class_='type2').find_all('li'):

                # url
                item_url = items.find('a')['href']

                # 상품코드
                item_code = item_url[-10:]

                # 가격 및 할인율
                if items.find('p',class_='prd_price').find('span',class_='del_important'):
                    original_price = items.find('p',class_='prd_price').find('span',class_='del_important').text.replace("원","")
                    discount_price = items.find('p',class_='prd_price').find('strong').text.replace("원","")
                    sale_rate = items.find('p',class_='prd_price').find('span',class_='splt_ico usr_clr').text

                else:
                    original_price = items.find('p',class_='prd_price').find('strong').text.replace("원","")
                    discount_price = "없음"
                    sale_rate = "없음"

                url_list.append(item_url)

                price_dic[item_code]={"정상가":original_price,"할인가":discount_price,"할인율":sale_rate}

            time.sleep(randint(1,10))

        self.driver.quit()

        return url_list , price_dic

    def check_start(self):

        url = self.connect()
        mall_name = self.shopping_mall()
        total_items = self.total_product()
        page_list = self.paging(total_items,url)
        url_list,price_dic = self.data_one(page_list)

if __name__ == "__main__":

    g_market = gmarket_sales()

    # g_market.check_start()

    schedule.every().hour.at(":20").do(g_market.check_start)

    while True:
        schedule.run_pending()
        time.sleep(1)

Hello, I am a student practicing web page crawling.
I'm making a code that scrapes data by parsing a website with selenium.

I wrote the program so that it runs at regular intervals using the final schedule module.
However, if chrome_driver is initialized in the init of the class and the driver.quit() command is put in the execution process, the MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError code is displayed when the second code is executed..

Below is the code I wrote.
I would really appreciate it if you could point out any problems.


来源: stackexchange

问:
Injecting code into Windows process running under Wine in Linux
I'm trying to inject code into Windows process (a game) running under Wine in Linux (for learning purposes, of course). Not a pre-built DLL, but native code.

On Windows, we can use procedures like VirtualAllocEx and WriteProcessMemory to write code to the virtual memory of a foreign process and then create a thread in it via CreateRemoteThread, thus executing our code in the context of the foreign process.
This is a popular approach, which is often used by all sorts of cheats and trainers for games. The popular game hacking program Cheat Engine has its own API that does this trick.

To do the same on Linux, you need a lot more, much more complex manipulations: attach to the process using ptrace, swapping registers and making system calls to allocate memory, write code there, then create a thread using the clone system call that will execute our code. And it will be even better and safer if the thread created by clone creates another thread using pthread_create, and the last one will already execute our code.

In order for a thread created with clone to jump to the desired code, the address of this code is written to the end of the memory allocated for its stack, and the clone system call itself is performed using the syscall instruction, followed by the ret instruction. This combination of instructions is easily found in libc.so.

I found an example in C on Github on how to do it correctly and implemented my own program. I won't include its source code here because it's quite large. Let me just say that it works as expected with native Linux processes. Moreover, I can also inject code that calls Linux routines (for example, puts from libc.so) into the Wine process and see the correct result:

```<code>lea rdi, [text]
call <libc.so code vaddr + `puts` offset>
ret

text:
db 'puts called successfully!', 0
</code>```

But when I try to call any Windows procedure in the thread created by pthread_create (be it any procedure from the game code or, for example, MessageBoxA from user32.dll), the thread hangs:

```<code>sub rsp, 32
xor rcx, rcx
lea rdx, [text]
lea r8, [caption]
mov r9, 0
call <user32.dll code vaddr + `MessageBoxA` offset>
add rsp, 32
ret

text:
db 'MessageBoxA called successfully!', 0
caption:
db 'Yaaay!', 0
</code>```

But why is this happening? After all, Wine is not an emulator, but just an API and system call compatibility layer. Doesn't this mean that the code itself runs natively on the processor, just like the code of any Linux programs, and I should be able to interoperate between them?

I suspect that the problem may be, for example, in the stack incompatibility. I once heard that Wine uses some kind of trick to convert the stack between Windows and Linux, but I don't know what exactly that trick is and I'm too bad to find and understand it in the Wine source code.

Could you explain to me exactly why my idea of calling Windows procedures from a thread created by pthread_create does not work and how can I make it work?

ContentLicense: CC BY-SA 4.0

Body:
I'm trying to inject code into Windows process (a game) running under Wine in Linux (for learning purposes, of course). Not a pre-built DLL, but native code.

On Windows, we can use procedures like VirtualAllocEx and WriteProcessMemory to write code to the virtual memory of a foreign process and then create a thread in it via CreateRemoteThread, thus executing our code in the context of the foreign process.
This is a popular approach, which is often used by all sorts of cheats and trainers for games. The popular game hacking program Cheat Engine has its own API that does this trick.

To do the same on Linux, you need a lot more, much more complex manipulations: attach to the process using ptrace, swapping registers and making system calls to allocate memory, write code there, then create a thread using the clone system call that will execute our code. And it will be even better and safer if the thread created by clone creates another thread using pthread_create, and the last one will already execute our code.

In order for a thread created with clone to jump to the desired code, the address of this code is written to the end of the memory allocated for its stack, and the clone system call itself is performed using the syscall instruction, followed by the ret instruction. This combination of instructions is easily found in libc.so.

I found an example in C on Github on how to do it correctly and implemented my own program. I won't include its source code here because it's quite large. Let me just say that it works as expected with native Linux processes. Moreover, I can also inject code that calls Linux routines (for example, puts from libc.so) into the Wine process and see the correct result:

lea rdi, [text]
call <libc.so code vaddr + `puts` offset>
ret

text:
db 'puts called successfully!', 0

But when I try to call any Windows procedure in the thread created by pthread_create (be it any procedure from the game code or, for example, MessageBoxA from user32.dll), the thread hangs:

sub rsp, 32
xor rcx, rcx
lea rdx, [text]
lea r8, [caption]
mov r9, 0
call <user32.dll code vaddr + `MessageBoxA` offset>
add rsp, 32
ret

text:
db 'MessageBoxA called successfully!', 0
caption:
db 'Yaaay!', 0

But why is this happening? After all, Wine is not an emulator, but just an API and system call compatibility layer. Doesn't this mean that the code itself runs natively on the processor, just like the code of any Linux programs, and I should be able to interoperate between them?

I suspect that the problem may be, for example, in the stack incompatibility. I once heard that Wine uses some kind of trick to convert the stack between Windows and Linux, but I don't know what exactly that trick is and I'm too bad to find and understand it in the Wine source code.

Could you explain to me exactly why my idea of calling Windows procedures from a thread created by pthread_create does not work and how can I make it work?


问:
Swiper: virtual and loop not working together
codeLink: https://codepen.io/wuyangqin/pen/OJEeQBg

```<code>var swiper = new Swiper(".swiper-container", {
  height: 400,
  width: 240,
  loop: true,
  autoplay:{
    delay: 2000
  },
  direction: 'vertical',
  slidesPerView: 1,
  centeredSlides: false,
  spaceBetween: 30,
  freeMode: true,
  freeModeSticky: true,
  mousewheel: true,
  slideToClickedSlide: true,
  pagination: {
    el: ".swiper-pagination",
    type: "fraction"
  },
  scrollbar: {
    el: ".swiper-scrollbar",
    draggable: true,
    dragSize: 40,
  },
  virtual: {
    slides: (function() {
      var slides = [];
      for (var i = 0; i < 4; i += 1) {
        slides.push(
          '<img src="https://picsum.photos/600/600/?image=' +
            (i + 1) +
            '"/><p>' +
            (i + 1) +
            "</p>"
        );
      }
      return slides;
    })()
  }
});

</code>```

When I set Loop:true, Swiper will stop when it reachEnd;
I tried the issue https://github.com/nolimits4web/swiper/issues/3070  But still not working

Expect loop and virtual working together

Body:
codeLink: https://codepen.io/wuyangqin/pen/OJEeQBg

var swiper = new Swiper(".swiper-container", {
  height: 400,
  width: 240,
  loop: true,
  autoplay:{
    delay: 2000
  },
  direction: 'vertical',
  slidesPerView: 1,
  centeredSlides: false,
  spaceBetween: 30,
  freeMode: true,
  freeModeSticky: true,
  mousewheel: true,
  slideToClickedSlide: true,
  pagination: {
    el: ".swiper-pagination",
    type: "fraction"
  },
  scrollbar: {
    el: ".swiper-scrollbar",
    draggable: true,
    dragSize: 40,
  },
  virtual: {
    slides: (function() {
      var slides = [];
      for (var i = 0; i < 4; i += 1) {
        slides.push(
          '
' +
            (i + 1) +
            "
"
        );
      }
      return slides;
    })()
  }
});

When I set Loop:true, Swiper will stop when it reachEnd;
I tried the issue https://github.com/nolimits4web/swiper/issues/3070  But still not working

Expect loop and virtual working together


问:
How to set value to the field in pojo model in spring boot which has another pojo model in it(Many to One Mapping)?
I would like to set value to the field in model which is another model in spring boot.(Many to one mapping) without using NEW Keyword.
Please consider below example,

```<code>public Class Model_1 {

private someFields;

@ManyToOne
@JoinColumn(name = "id")
  private Trade dTrade;
}
</code>```

Other Model :

```<code>public Class Model_2 {

private id;

}
</code>```

Now i want to set value to id field in Model_2 class, so we do like below

Model_1 modelOne = new Model_1;

Model_2 modelTwo = new Model_2;
modelTwo.setId(1);

modelOne.setDtrade(modelTwo);

Like i mention above is the usual way to achieve it.

Could you please let me know any other way around to achieve it without USING NEW KEYWORD which creates new instance and facing some issue due to that. I want to achieve without the new keyword for some reason. Kindly let me know. Really Appriciated and much thanks.

Thank you !!!

Body:
I would like to set value to the field in model which is another model in spring boot.(Many to one mapping) without using NEW Keyword.
Please consider below example,

public Class Model_1 {

private someFields;

@ManyToOne
@JoinColumn(name = "id")
  private Trade dTrade;
}

Other Model :

public Class Model_2 {

private id;

}

Now i want to set value to id field in Model_2 class, so we do like below

Model_1 modelOne = new Model_1;

Model_2 modelTwo = new Model_2;
modelTwo.setId(1);

modelOne.setDtrade(modelTwo);

Like i mention above is the usual way to achieve it.

Could you please let me know any other way around to achieve it without USING NEW KEYWORD which creates new instance and facing some issue due to that. I want to achieve without the new keyword for some reason. Kindly let me know. Really Appriciated and much thanks.

Thank you !!!


问:
Jobrunr is not starting up in DEVELOPMENT env
Jobrunr fails during startup in a micronaut application DEVELOPMENT environment. It works fine in local IDE. Below is the configuration:

```<code>jobrunr:
  database:
    type: sql
    datasource: default
    skip-create: true
    table_prefix: 'jobrunr.'
  background-job-server:
    enabled: ${JOBRUNR_JOBS:false}
  dashboard:
    enabled: true
  job-scheduler:
    enabled: true
  jobs:
    retry-back-off-time-seed: 2
</code>```

Below is the actual exception:

```<code>"stack_trace":"java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.get(Optional.java:143)
at org.jobrunr.micronaut.autoconfigure.JobRunrStarter.startup(JobRunrStarter.java:32)
at org.jobrunr.micronaut.autoconfigure.$JobRunrStarter$Definition$Exec.dispatch(Unknown Source)
at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:378)
at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:3807)
at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:83)
at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
at org.jobrunr.micronaut.autoconfigure.JobRunrStarter$ApplicationEventListener$startup1$Intercepted.onApplicationEvent(Unknown Source)
at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262)
at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60)
at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)
at io.micronaut.http.server.netty.NettyHttpServer.fireStartupEvents(NettyHttpServer.java:557)
at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:300)
at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:111)
at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:76)
at com.app.ApplicationKt.main(Application.kt:12)\n"
</code>```

It seems like the injection is not happening well? I am using micronaut version 3.5.2, Kotlin version 1.6.21 and jobrunr version 5.1.6

Body:
Jobrunr fails during startup in a micronaut application DEVELOPMENT environment. It works fine in local IDE. Below is the configuration:

jobrunr:
  database:
    type: sql
    datasource: default
    skip-create: true
    table_prefix: 'jobrunr.'
  background-job-server:
    enabled: ${JOBRUNR_JOBS:false}
  dashboard:
    enabled: true
  job-scheduler:
    enabled: true
  jobs:
    retry-back-off-time-seed: 2

Below is the actual exception:

"stack_trace":"java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.get(Optional.java:143)
at org.jobrunr.micronaut.autoconfigure.JobRunrStarter.startup(JobRunrStarter.java:32)
at org.jobrunr.micronaut.autoconfigure.$JobRunrStarter$Definition$Exec.dispatch(Unknown Source)
at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:378)
at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:3807)
at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:83)
at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
at org.jobrunr.micronaut.autoconfigure.JobRunrStarter$ApplicationEventListener$startup1$Intercepted.onApplicationEvent(Unknown Source)
at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262)
at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60)
at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)
at io.micronaut.http.server.netty.NettyHttpServer.fireStartupEvents(NettyHttpServer.java:557)
at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:300)
at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:111)
at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:76)
at com.app.ApplicationKt.main(Application.kt:12)\n"

It seems like the injection is not happening well? I am using micronaut version 3.5.2, Kotlin version 1.6.21 and jobrunr version 5.1.6


问:
REPLACE() in Postgres can't replace data
I'm new in postgres, I'm creating a procedure to rename table constraint names using the REPLACE(). If I test all the variables in this procedure the data is there and if I replace it manually it can. The problem is when this procedure is running the constraint name doesn't change.

```<code>create or replace procedure public.rename_existing_constraint_table(in table_name text, in date_now text, in list_constraint text[])
    as $$ declare
        const text;
        table_rename text;
    begin
        table_rename := (select concat(table_name, '_', date_now));
        if array_length(list_constraint, 1) >= 1 then
            foreach const in array list_constraint loop
                execute 'alter table if exists ' || table_name || ' RENAME CONSTRAINT ' || const || ' to ' || replace(const, table_name, table_rename);
            end loop;
        end if;
    end $$
language plpgsql;
</code>```

duplicate error because the data was not successfully renamed, it should be
app_devlogdetail_pkey to app_devlogdetail_20221214_pkey

```<code>psycopg2.errors.DuplicateTable: relation "app_devlogdetail_pkey" already exists
CONTEXT:  SQL statement "alter table if exists app_devlogdetail_20221214 RENAME CONSTRAINT app_devlogdetail_pkey to app_devlogdetail_pkey"
PL/pgSQL function rename_existing_constraint_table(text,text,text[]) line 10 at EXECUTE
</code>```

I have tried running the REPLACE() outside the procedure and it runs normally and the data can be changed, but when it is run inside the procedure to be executed the REPLACE() can't changed data. How to make the REPLACE() can run and the data can be changed or is there some other way around it?

Body:
I'm new in postgres, I'm creating a procedure to rename table constraint names using the REPLACE(). If I test all the variables in this procedure the data is there and if I replace it manually it can. The problem is when this procedure is running the constraint name doesn't change.

create or replace procedure public.rename_existing_constraint_table(in table_name text, in date_now text, in list_constraint text[])
    as $$ declare
        const text;
        table_rename text;
    begin
        table_rename := (select concat(table_name, '_', date_now));
        if array_length(list_constraint, 1) >= 1 then
            foreach const in array list_constraint loop
                execute 'alter table if exists ' || table_name || ' RENAME CONSTRAINT ' || const || ' to ' || replace(const, table_name, table_rename);
            end loop;
        end if;
    end $$
language plpgsql;

duplicate error because the data was not successfully renamed, it should be
app_devlogdetail_pkey to app_devlogdetail_20221214_pkey

psycopg2.errors.DuplicateTable: relation "app_devlogdetail_pkey" already exists
CONTEXT:  SQL statement "alter table if exists app_devlogdetail_20221214 RENAME CONSTRAINT app_devlogdetail_pkey to app_devlogdetail_pkey"
PL/pgSQL function rename_existing_constraint_table(text,text,text[]) line 10 at EXECUTE

I have tried running the REPLACE() outside the procedure and it runs normally and the data can be changed, but when it is run inside the procedure to be executed the REPLACE() can't changed data. How to make the REPLACE() can run and the data can be changed or is there some other way around it?


问:
Crontab using python venv
I'm trying to execute a python code in a daily basis. To achieve this, i'm using cron tab on mac os, using a virtual enviroment. To activate it, i've created the following cron tab statement:

7 23 * * * /Users/dvilches/Desktop/Python/NewProject/env/bin/python /Users/dvilches/Desktop/Python/NewProject/data_analyst.py

Unfortunately, this isn't working.

any suggestions?

Thank you very much!

I googled this problem before, but the issue remain.

Title: Crontab using python venv


问:
For SSRS Parameter, How to show dates after a certain date in calendar instead of a drop down list?
When setting date range parameter for a SSRS report, I would like to show dates in calendar (like the attached picture below), while the calendar should have a earliest from date 2022-01-01 (which means once user click on the From Date calendar, it will not show dates earlier than 2022-01-01).

I'm not sure if this is possible?

I have tried to use a dataset to list dates after 2022-01-01, but this would turn @Fromdate into a drop down list instead of a calendar.

I'm really appreciate if any one could help. Thanks a lot!
Best Regards.


问:
How do I connect two nodes in elasticsearch?
Now I have two nodes(192.168.72.129, 192.168.72.130)

It's the setting in config/elasticsearch.yml

======node-1======

```<code>cluster.name: cluster-es
node.name: node-1
network.host: 0.0.0.0
node.master: true
node.data: true
http.port: 9200
http.cors.allow-origin: "*"
http.cors.enabled: true
transport.port: 9300
http.max_content_length: 200mb
cluster.initial_master_nodes: ["node-1"]
discovery.seed_hosts: ["192.168.72.129","192.168.72.130"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
cluster.routing.allocation.cluster_concurrent_rebalance: 16
cluster.routing.allocation.node_concurrent_recoveries: 16
cluster.routing.allocation.node_initial_primaries_recoveries: 16
</code>```

======node-2======

```<code>cluster.name: cluster-es
node.name: node-2
network.host: 0.0.0.0
node.master: true
node.data: true
http.port: 9200
http.cors.allow-origin: "*"
http.cors.enabled: true
transport.port: 9300
http.max_content_length: 200mb
cluster.initial_master_nodes: ["node-1"]
discovery.seed_hosts: ["192.168.72.129","192.168.72.130"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
cluster.routing.allocation.cluster_concurrent_rebalance: 16
cluster.routing.allocation.node_concurrent_recoveries: 16
cluster.routing.allocation.node_initial_primaries_recoveries: 16
</code>```

but when I curl http://192.168.72.129:9200/_cat/nodes
there is only one node to show, how can I solve it?

Body:
Now I have two nodes(192.168.72.129, 192.168.72.130)

It's the setting in config/elasticsearch.yml

======node-1======

cluster.name: cluster-es
node.name: node-1
network.host: 0.0.0.0
node.master: true
node.data: true
http.port: 9200
http.cors.allow-origin: "*"
http.cors.enabled: true
transport.port: 9300
http.max_content_length: 200mb
cluster.initial_master_nodes: ["node-1"]
discovery.seed_hosts: ["192.168.72.129","192.168.72.130"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
cluster.routing.allocation.cluster_concurrent_rebalance: 16
cluster.routing.allocation.node_concurrent_recoveries: 16
cluster.routing.allocation.node_initial_primaries_recoveries: 16

======node-2======

cluster.name: cluster-es
node.name: node-2
network.host: 0.0.0.0
node.master: true
node.data: true
http.port: 9200
http.cors.allow-origin: "*"
http.cors.enabled: true
transport.port: 9300
http.max_content_length: 200mb
cluster.initial_master_nodes: ["node-1"]
discovery.seed_hosts: ["192.168.72.129","192.168.72.130"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
cluster.routing.allocation.cluster_concurrent_rebalance: 16
cluster.routing.allocation.node_concurrent_recoveries: 16
cluster.routing.allocation.node_initial_primaries_recoveries: 16

but when I curl http://192.168.72.129:9200/_cat/nodes
there is only one node to show, how can I solve it?


问:
std::thread not showing result of std::cout
I'm learning C++ multithreading and below is a piece of code I wrote. I'm using Visual Studio Code version 1.67.2. The goal is to spawn a thread and conduct a fizzbuzz game using the name of the player given:

```<code>#include <iostream>
#include <thread>
#include <string>

using namespace std;

const int nplayers{4};
const int max_number{30};
string player_names[] = {"Abdul", "Bart", "Claudia", "Divya"};

void speak() {
    for (int n = 1; n <= max_number; ++n) {
        string player = player_names[(n-1)%nplayers];

        cout << player << " says ";

        if (n % 3 == 0 && n % 5 == 0) {
            cout << "fizzbuzz!";
        }
        else if (n % 3 == 0) {
            cout << "fizz!";
        }
        else if (n % 5 == 0) {
            cout << "buzz!";
        }
        else {
            cout << n;
        }
        cout << endl;
    }
}

int main() {
    // speak();
    thread game{speak};
    game.join();
}
</code>```

The desire output is:

```<code>Abdul says 1
Bart says 2
Claudia says fizz!
Divya says 4
</code>```

But instead, the there's nothing shown in the output as shown in the following image:
output from visual studio code
I'm using the g++ compiler in linux bash terminal native to visual studio code to compile the code. There are no errors in the compilation, but after I exectue the code, there's nothing showing.

Could anyone help me to catch the bug or identify the problem?
Thanks.

Body:
I'm learning C++ multithreading and below is a piece of code I wrote. I'm using Visual Studio Code version 1.67.2. The goal is to spawn a thread and conduct a fizzbuzz game using the name of the player given:

#include <iostream>
#include <thread>
#include <string>

using namespace std;

const int nplayers{4};
const int max_number{30};
string player_names[] = {"Abdul", "Bart", "Claudia", "Divya"};

void speak() {
    for (int n = 1; n <= max_number; ++n) {
        string player = player_names[(n-1)%nplayers];

        cout << player << " says ";

        if (n % 3 == 0 && n % 5 == 0) {
            cout << "fizzbuzz!";
        }
        else if (n % 3 == 0) {
            cout << "fizz!";
        }
        else if (n % 5 == 0) {
            cout << "buzz!";
        }
        else {
            cout << n;
        }
        cout << endl;
    }
}

int main() {
    // speak();
    thread game{speak};
    game.join();
}

The desire output is:

Abdul says 1
Bart says 2
Claudia says fizz!
Divya says 4

But instead, the there's nothing shown in the output as shown in the following image:
output from visual studio code
I'm using the g++ compiler in linux bash terminal native to visual studio code to compile the code. There are no errors in the compilation, but after I exectue the code, there's nothing showing.

Could anyone help me to catch the bug or identify the problem?
Thanks.


问:
how to push values from an array of objects to another array javascript
I am using React and I want to push data from an array of object to another empty array present in an object.
I want to push the data from the array devices to an empty array devicesList.
devices is logged like this on the console:

```<code>(2) [Device, Device]
0: Device {deviceName: 'AC', deviceStatus: 'off'}
1: Device {deviceName: 'TV', deviceStatus: 'off'}

</code>```

I have a function that added on click the devicesto the devicesList. I want that to each time I add a new device to the array devices it adds it by the push() method at the end of the devicesList array.
The problem is that when I am using devicesList.push(devices)the data are not added to the destination array per index. It is added like this:

```<code>devicesList: Array(3)
0: []
1: [Device]
Device {deviceName: 'Light', deviceStatus: 'off'}
2: (2) [Device, Device]
0: Device {deviceName: 'Light', deviceStatus: 'off'}
1: Device {deviceName: 'Stereo', deviceStatus: 'off'}
length: 3
</code>```

How can I push the data from devices so the array devicesList looked rather like this :

```<code>devicesList: Array(3)
0: []
1: [Device]
Device {deviceName: 'Light', deviceStatus: 'off'}
2: [Device]
Device {deviceName: 'Stereo', deviceStatus: 'off'}
length: 3
</code>```

Here is the code:

```<code>
  const [showAdd, setShowAdd] = useState(false);

  const [deviceName,setDeviceName]=useState('')

  const [deviceStatus,setDeviceStatus]=useState('off')

  const [devices,setDevices]=useState([])

  const AddNewDevice=(deviceName,deviceStatus)=>{

        //1st step: Validation of the device:

    let containsStereo=devices.some(e => e.deviceName === 'Stereo')
    let isBathroom=currentRoom.roomType === 'Bathroom'

    let devicesList=currentRoom.devicesList

    if ((containsStereo&&deviceName=='Stereo')||(!isBathroom&&deviceName=='Boiler')||(devicesList.length>5)) return alert('error')
    else {

      //2nd if validated creation of new device

    const newDevice = new Device(deviceName, deviceStatus);
    console.log(newDevice);

    setDevices([...devices,newDevice])
    console.log(devices);

    devicesList.push(devices);

    console.log(currentRoom);

  }

  return devicesList

  }

</code>```

Body:
I am using React and I want to push data from an array of object to another empty array present in an object.
I want to push the data from the array devices to an empty array devicesList.
devices is logged like this on the console:

(2) [Device, Device]
0: Device {deviceName: 'AC', deviceStatus: 'off'}
1: Device {deviceName: 'TV', deviceStatus: 'off'}

I have a function that added on click the devicesto the devicesList. I want that to each time I add a new device to the array devices it adds it by the push() method at the end of the devicesList array.
The problem is that when I am using devicesList.push(devices)the data are not added to the destination array per index. It is added like this:

devicesList: Array(3)
0: []
1: [Device]
Device {deviceName: 'Light', deviceStatus: 'off'}
2: (2) [Device, Device]
0: Device {deviceName: 'Light', deviceStatus: 'off'}
1: Device {deviceName: 'Stereo', deviceStatus: 'off'}
length: 3

How can I push the data from devices so the array devicesList looked rather like this :

devicesList: Array(3)
0: []
1: [Device]
Device {deviceName: 'Light', deviceStatus: 'off'}
2: [Device]
Device {deviceName: 'Stereo', deviceStatus: 'off'}
length: 3

Here is the code:

  const [showAdd, setShowAdd] = useState(false);

  const [deviceName,setDeviceName]=useState('')

  const [deviceStatus,setDeviceStatus]=useState('off')

  const [devices,setDevices]=useState([])

  const AddNewDevice=(deviceName,deviceStatus)=>{

        //1st step: Validation of the device:

    let containsStereo=devices.some(e => e.deviceName === 'Stereo')
    let isBathroom=currentRoom.roomType === 'Bathroom'

    let devicesList=currentRoom.devicesList

    if ((containsStereo&&deviceName=='Stereo')||(!isBathroom&&deviceName=='Boiler')||(devicesList.length>5)) return alert('error')
    else {

      //2nd if validated creation of new device

    const newDevice = new Device(deviceName, deviceStatus);
    console.log(newDevice);

    setDevices([...devices,newDevice])
    console.log(devices);

    devicesList.push(devices);

    console.log(currentRoom);

  }

  return devicesList

  }


问:
BulkExecution in Azure CosmosDB for ASP.Net MVC 4.7.2 version
Description:
What's my goal : want to do bulk execution for Vertices and edges to create graph in azure cosmosDB with c# code as below

BulkOperationResponse bulkOperationResponse1 =await graphBulkExecutor.BulkImportAsync( gremlinElements: gremlinElements1, enableUpsert: true);
```
<p>Source : https://github.com/Azure-Samples/azure-cosmos-graph-bulk-executor</p>
<p><em><strong>Result:</strong></em> This approach working very well with <code>.NET Core MVC</code> application but not with <code>ASP.NET Framework MVC</code> app.</p>
<p><em><strong>Issue area:</strong></em> After debugging I found the exception line is at</p>
<pre class="lang-cs prettyprint-override"><code> await this.InitializeAsync(cancellationToken);"
</code>```

and this is from

Body:
Description:
What's my goal : want to do bulk execution for Vertices and edges to create graph in azure cosmosDB with c# code as below

BulkOperationResponse bulkOperationResponse1 =await graphBulkExecutor.BulkImportAsync( gremlinElements: gremlinElements1, enableUpsert: true);

Source : https://github.com/Azure-Samples/azure-cosmos-graph-bulk-executor

Result: This approach working very well with .NET Core MVC application but not with ASP.NET Framework MVC app.

Issue area: After debugging I found the exception line is at

 await this.InitializeAsync(cancellationToken);"

and this is from


问:
Making MySQL connection global in python
How to make MySQL connection global in python.Does adding connection.close() on every function makes the connection stand still if global is declared outside.

I tried to declare connection global outside but unfortunately got a page full error and I was satisfied. The error highlight like (Unread result found)


问:
Copy clipboard in Javascript doesn't work on phone
I have a copy clipboard code here that is working fine on desktop/PC but on phone is doesnt work, can anyone here please help. I'm new on javascript</p>
```<code>let handleCopyClick = document.querySelector('#copy-username');

    handleCopyClick.addEventListener('click', () => {

         navigator.clipboard.writeText('<?php echo $username; ?>');

        alert('Username <?php echo $username; ?> has been copied to clipboard!');
    });
</code>```

Body:
I have a copy clipboard code here that is working fine on desktop/PC but on phone is doesnt work, can anyone here please help. I'm new on javascript

let handleCopyClick = document.querySelector('#copy-username');

    handleCopyClick.addEventListener('click', () => {

         navigator.clipboard.writeText('<?php echo $username; ?>');

        alert('Username <?php echo $username; ?> has been copied to clipboard!');
    });


问:
How to control div elements in bootstrap?
I am trying to use two container in row and with window resize they auto resize till md size and then stack up on each other

But I am having issues with controlling the image size in the container as it resizes rather than reducing with window size.

When i sample test they go well as below
but When i use image and content , it will resize and making an issue

`

```<code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 4 Three Column Grid Layouts for Tablets (landscape) and Desktops</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script>
<style>
    /* Some custom styles to beautify this example */
    .demo-content{
        padding: 15px;
        font-size: 18px;
        background: #dbdfe5;
        margin-bottom: 15px;
    }
    .demo-content.bg-alt{
        background: #abb1b8;
    }
</style>
</head>
<body>
    <h2 class="text-center my-3">Bootstrap Responsive Layout</h2>
    <div class="text-center">Open the output in a new blank tab (Click the arrow next to "Show Output" button) and resize the browser window to understand how the Bootstrap responsive grid system works.</div>
    <div class="container mt-3">
        <!--Row with three equal columns-->
        <div class="row">
            <div class="col-lg-4">
                <div class="demo-content">.col-lg-4</div>
            </div>
            <div class="col-lg-4">
                <div class="demo-content bg-alt">.col-lg-4</div>
            </div>
            <div class="col-lg-4">
                <div class="demo-content">.col-lg-4</div>
            </div>
        </div>

        <!--Row with three columns divided in 1:4:1 ratio-->
        <div class="row">
            <div class="col-lg-2">
                <div class="demo-content">.col-lg-2</div>
            </div>
            <div class="col-lg-8">
                <div class="demo-content bg-alt">.col-lg-8</div>
            </div>
            <div class="col-lg-2">
                <div class="demo-content">.col-lg-2</div>
            </div>
        </div>

        <!--Row with three columns divided unevenly-->
        <div class="row">
            <div class="col-lg-3">
                <div class="demo-content">.col-lg-3</div>
            </div>
            <div class="col-lg-7">
                <div class="demo-content bg-alt">.col-lg-7</div>
            </div>
            <div class="col-lg-2">
                <div class="demo-content">.col-lg-2</div>
            </div>
        </div>
    </div>
</body>
</html>
</code>```

`

Body:
I am trying to use two container in row and with window resize they auto resize till md size and then stack up on each other

But I am having issues with controlling the image size in the container as it resizes rather than reducing with window size.

When i sample test they go well as below
but When i use image and content , it will resize and making an issue

`

<!DOCTYPE html>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 4 Three Column Grid Layouts for Tablets (landscape) and Desktops</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">

Bootstrap Responsive Layout

Open the output in a new blank tab (Click the arrow next to "Show Output" button) and resize the browser window to understand how the Bootstrap responsive grid system works.

.col-lg-4

.col-lg-4

.col-lg-4

.col-lg-2

.col-lg-8

.col-lg-2

.col-lg-3

.col-lg-7

.col-lg-2

`


问:
PHP-FPM returns 200 but Nginx sending 504 gateway error
Looking at the Nginx log, I can see the following 504 error

```<code>139.47.72.206 - - [14/Dec/2022:02:36:56 +0000] "GET /wp-admin/admin.php?page=wc-settings&tab=shipping HTTP/2.0" 504 562 "https://connetixtiles.com/wp-admin/admin.php?page=wc-settings&tab=tax" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" "-"
</code>```

However, if I look at the PHP-FPM access log

```<code>{"p":"23197","t":"14/Dec/2022:02:33:56 +0000","T":"14/Dec/2022:02:34:58 +0000","d":"1.826","r":"/wp-admin/admin.php?page=wc-settings&tab=shipping","m":"GET","R":"139.47.72.206","C":"84.87","M":"181579776","s":"200","X":"-"}
</code>```

It seems that the PHP-FPM sends success but Nginx doesn't seem to be able to deliver it, so it times out after 3 minutes (max_execution_time is 180s)

It works for other pages.

Ideas?

Body:
Looking at the Nginx log, I can see the following 504 error

139.47.72.206 - - [14/Dec/2022:02:36:56 +0000] "GET /wp-admin/admin.php?page=wc-settings&tab=shipping HTTP/2.0" 504 562 "https://connetixtiles.com/wp-admin/admin.php?page=wc-settings&tab=tax" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" "-"

However, if I look at the PHP-FPM access log

{"p":"23197","t":"14/Dec/2022:02:33:56 +0000","T":"14/Dec/2022:02:34:58 +0000","d":"1.826","r":"/wp-admin/admin.php?page=wc-settings&tab=shipping","m":"GET","R":"139.47.72.206","C":"84.87","M":"181579776","s":"200","X":"-"}

It seems that the PHP-FPM sends success but Nginx doesn't seem to be able to deliver it, so it times out after 3 minutes (max_execution_time is 180s)

It works for other pages.

Ideas?


问:
Causes of performance differences with different instruction orderings?
I ran into a performance issue with a function similar to the following:

```<code>pub fn attacked(&self, sq: usize) -> bool {
    self.lut1[sq] || self.lut2[sq] || self.lut3[sq] || self.lut4[sq] || self.lut5[sq]
}
</code>```

A number of look-up tables (i.e. arrays, [u64; N]) are queried and if any return true the result is true. It is a part of a larger program running a simulation. This lookup comprises about 5% of the logic. I measure the throughput of this simulation to look at performance. I use codegen-units = 1 and opt-level = 3.

It turns out that different orderings of the luts results in significantly different performance times. For certain orderings I get 65 Mnodes/s, while other orderings I get 50 Mnodes/s.

My data ensures that hitting any of the luts is equally likely so although evaluation is left-to-right, there shouldn't be a different due to short-circuiting. The tables are held in a struct on the stack and the total size is about 1MB, so it should be able to remain in CPU cache and not be affected by memory latency.

I'm not able to recreate a working example as when I start taking out seemingly unrelated code, the performance behavior changes or slowdown disappears.

I'm left baffled. Could the compiler sub-optimize due to instruction ordering? What other causes can there be?

Body:
I ran into a performance issue with a function similar to the following:

pub fn attacked(&self, sq: usize) -> bool {
    self.lut1[sq] || self.lut2[sq] || self.lut3[sq] || self.lut4[sq] || self.lut5[sq]
}

A number of look-up tables (i.e. arrays, [u64; N]) are queried and if any return true the result is true. It is a part of a larger program running a simulation. This lookup comprises about 5% of the logic. I measure the throughput of this simulation to look at performance. I use codegen-units = 1 and opt-level = 3.

It turns out that different orderings of the luts results in significantly different performance times. For certain orderings I get 65 Mnodes/s, while other orderings I get 50 Mnodes/s.

My data ensures that hitting any of the luts is equally likely so although evaluation is left-to-right, there shouldn't be a different due to short-circuiting. The tables are held in a struct on the stack and the total size is about 1MB, so it should be able to remain in CPU cache and not be affected by memory latency.

I'm not able to recreate a working example as when I start taking out seemingly unrelated code, the performance behavior changes or slowdown disappears.

I'm left baffled. Could the compiler sub-optimize due to instruction ordering? What other causes can there be?


问:
python not recognizing predefined variables
I am fairly new to both python and kivy, and i'm trying to display a list from python as a label in kivy as part of a larger piece of code.

My code is very long, so here are the main bits which concern my query.
.py file:

```<code>line 0125 class ScreenSeven(Screen):
line 0126     def add_myapp(self,myapp):
line 0127         self.myapp=myapp
.....
line 0204         routine = []
.....
line 2360     ScreenSevenDisplay = StringProperty("here is your workout\n"+" ".join(routine))
line 2361     def __init__(self, **kwargs):
line 2362         super(ScreenSeven, self).__init__(**kwargs)
</code>```

.kv file

```<code><ScreenSeven>:
    BoxLayout:
        orientation: 'vertical'
        padding: 40
        spacing: 10
    Label:
        id: ScreenSevenDisplay_label
        text: root.ScreenSevenDisplay
</code>```

All of the code enclosed in lines 0125-2362 are all within the class ScreenSeven. I was hoping my code would display a label in the kivy window containing the string defined in line 2360. However, before I even run the code it says the routine in line 2360 is undefined. I have checked all over for indentation errors and it is clean from them to the best of my knowledge. Any help would be greatly appreciated. Thanks.

Body:
I am fairly new to both python and kivy, and i'm trying to display a list from python as a label in kivy as part of a larger piece of code.

My code is very long, so here are the main bits which concern my query.
.py file:

line 0125 class ScreenSeven(Screen):
line 0126     def add_myapp(self,myapp):
line 0127         self.myapp=myapp
.....
line 0204         routine = []
.....
line 2360     ScreenSevenDisplay = StringProperty("here is your workout\n"+" ".join(routine))
line 2361     def __init__(self, **kwargs):
line 2362         super(ScreenSeven, self).__init__(**kwargs)

.kv file

<ScreenSeven>:
    BoxLayout:
        orientation: 'vertical'
        padding: 40
        spacing: 10
    Label:
        id: ScreenSevenDisplay_label
        text: root.ScreenSevenDisplay

All of the code enclosed in lines 0125-2362 are all within the class ScreenSeven. I was hoping my code would display a label in the kivy window containing the string defined in line 2360. However, before I even run the code it says the routine in line 2360 is undefined. I have checked all over for indentation errors and it is clean from them to the best of my knowledge. Any help would be greatly appreciated. Thanks.


问:
7Zip - Powershell - $LastExitCode Issues
Pretty sure just me not knowing what to do but I am having issues with a 7zip PS script and the $LastExitCode

```<code>ForEach ($File in $Files) {

    7zip a “$DestDir\$file.7z” "$SourceDir\$File” -m0=LZMA2 -mx=9 -mmt4 | findstr /I "archive everything error" | Out-File $LOGPath -Force -Append
    7zip t "$DestDir\$file.7z" | findstr /I "testing size compressed archive everything error" | Out-File $LOGPath -Force -Append

    if ($LASTEXITCODE -eq 0) {
        Write-Output  “Compression SUCCEEDED and zip file tested OK” | Out-File $LOGPath -Force -Append
        Write-Output  “DELETING ORIGINAL file - $File `n” | Out-File $LOGPath -Force -Append
        Remove-Item -Path “$SourceDir\$File” | Out-File $LOGPath -Force -Append
    }
    else {
        Write-Output “Compression FAILED, source file not deleted `n” | Out-File $LOGPath -Force -Append
    }
}
</code>```

This is the script (important bits)

It does a zip then a test of the created package

So to test that the $LastExitCode is working (or not), I # out the zip part and leave the test step and remove any zip files from the destination folder. The zip test step fails as expected and sends an error to log (Error:cannot find archive) but still goes through with the remove-item, which should only occur if the test passes I would have throught??

Not sure what I am doing worng here? Or if this is the incorrect way to go about this?

I want to create the archive, confirm it is OK, then delete the original source file if it is (i.e. no errors).

Any advice really apprecited

thanks

EDIT

Ended up with below that seems to do the trick - thanks for the advice

```<code>ForEach ($File in $Files) {

Write-Output “Compressing $File” | Out-File $LOGPath -Force -Append
7zip a "$DestDir\$file.7z” "$SourceDir\$File" -m0=LZMA2 -mx=9 -mmt4

if ($LASTEXITCODE -eq 0) {
    Write-Output  "Compression SUCCEEDED" | Out-File $LOGPath -Force -Append
    Write-Output “TESTING compressed file - $File” | Out-File $LOGPath -Force -Append
    7zip t "$DestDir\$file.7z"

        if ($LASTEXITCODE -eq 0) {
            Write-Output  "Zip file tested OK" | Out-File $LOGPath -Force -Append
            Write-Output  "DELETING original file - $File `n" | Out-File $LOGPath -Force -Append
            #Remove-Item -Path “$SourceDir\$File” | Out-File $LOGPath -Force -Append
        }
            else {
                Write-Output “Zip test FAILED, source file not deleted `n” | Out-File $LOGPath -Force -Append
            }
  }

    else {
        Write-Output "Compression FAILED for file - $file - moving onto next file" | Out-File $LOGPath -Force -Append
    }

</code>```

}

Body:
Pretty sure just me not knowing what to do but I am having issues with a 7zip PS script and the $LastExitCode

ForEach ($File in $Files) {

    7zip a “$DestDir\$file.7z” "$SourceDir\$File” -m0=LZMA2 -mx=9 -mmt4 | findstr /I "archive everything error" | Out-File $LOGPath -Force -Append
    7zip t "$DestDir\$file.7z" | findstr /I "testing size compressed archive everything error" | Out-File $LOGPath -Force -Append

    if ($LASTEXITCODE -eq 0) {
        Write-Output  “Compression SUCCEEDED and zip file tested OK” | Out-File $LOGPath -Force -Append
        Write-Output  “DELETING ORIGINAL file - $File `n” | Out-File $LOGPath -Force -Append
        Remove-Item -Path “$SourceDir\$File” | Out-File $LOGPath -Force -Append
    }
    else {
        Write-Output “Compression FAILED, source file not deleted `n” | Out-File $LOGPath -Force -Append
    }
}

This is the script (important bits)

It does a zip then a test of the created package

So to test that the $LastExitCode is working (or not), I # out the zip part and leave the test step and remove any zip files from the destination folder. The zip test step fails as expected and sends an error to log (Error:cannot find archive) but still goes through with the remove-item, which should only occur if the test passes I would have throught??

Not sure what I am doing worng here? Or if this is the incorrect way to go about this?

I want to create the archive, confirm it is OK, then delete the original source file if it is (i.e. no errors).

Any advice really apprecited

thanks

EDIT

Ended up with below that seems to do the trick - thanks for the advice

ForEach ($File in $Files) {

Write-Output “Compressing $File” | Out-File $LOGPath -Force -Append
7zip a "$DestDir\$file.7z” "$SourceDir\$File" -m0=LZMA2 -mx=9 -mmt4

if ($LASTEXITCODE -eq 0) {
    Write-Output  "Compression SUCCEEDED" | Out-File $LOGPath -Force -Append
    Write-Output “TESTING compressed file - $File” | Out-File $LOGPath -Force -Append
    7zip t "$DestDir\$file.7z"

        if ($LASTEXITCODE -eq 0) {
            Write-Output  "Zip file tested OK" | Out-File $LOGPath -Force -Append
            Write-Output  "DELETING original file - $File `n" | Out-File $LOGPath -Force -Append
            #Remove-Item -Path “$SourceDir\$File” | Out-File $LOGPath -Force -Append
        }
            else {
                Write-Output “Zip test FAILED, source file not deleted `n” | Out-File $LOGPath -Force -Append
            }
  }

    else {
        Write-Output "Compression FAILED for file - $file - moving onto next file" | Out-File $LOGPath -Force -Append
    }

}


问:
How do I have an equally spaced distance between two parts of a string?
I am attempting to have a string output a name and the person's grade:
name      grade

But if the student's name length is different, I want to get the same spacing between the rows..

```<code>The goal:
Name: billy     Grade: 91

Name: Johnson   Grade: 79

The output:
Name: billy     Grade: 91

Name: Johnson     Grade: 79
</code>```

Body:
I am attempting to have a string output a name and the person's grade:
name      grade

But if the student's name length is different, I want to get the same spacing between the rows..

The goal:
Name: billy     Grade: 91

Name: Johnson   Grade: 79

The output:
Name: billy     Grade: 91

Name: Johnson     Grade: 79


问:
Slow service Hibernate
My project requires a service that will repeatable migration between two tables on two different databases. I have implemented this via Hibernate. So, I have a service that fetches data from the primary database table and then migrate it to the second database table, however, my primary database table has over 200000 rows and the iterator takes quite a long time to complete the task.

What should I use to speed up the process?

Here is the Service code:

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

    @Autowired
    TrmInCardClientDBRepository trmInCardClientDBRepository;
    @Autowired
    TrmInCardClientUKMRepository trmInCardClientUKMRepository;
    private Logger log = Logger.getLogger(TrmInCardClientService.class.getName());

    public TrmInCardClientService() {
    }

    @Scheduled(
            fixedRate = 300000
    )
    public void updatelist() {
        this.log.info("TrmInCardClient data transfer start");
        try {
            Iterable<TrmInCardClientUKM> trmInCardClientUKMS = this.trmInCardClientUKMRepository.findByDeleted(0);
            List<TrmInCardClientUKM> trmInCardClientUKMList = new ArrayList();
            List<TrmInCardClientDB> trmInCardClientDBList = new ArrayList<>();
            Iterator var5 = trmInCardClientUKMS.iterator();

            while (var5.hasNext()) {
                TrmInCardClientUKM cardClientUKM = (TrmInCardClientUKM) var5.next();
                trmInCardClientUKMList.add(cardClientUKM);
                trmInCardClientDBList.add(new TrmInCardClientDB(cardClientUKM.getCard(), cardClientUKM.getClient(),
                        cardClientUKM.getDeleted(), cardClientUKM.getGlobal_id(), cardClientUKM.getVersion()));
            }

            this.trmInCardClientDBRepository.saveAll(trmInCardClientDBList);
            this.log.info("TrmInCardClient data transfer end");
        }
        catch (Exception e) {
            this.log.warning("Error encountered during TrmInCardClient data migration");
        }
    }
}
</code>```

Title: Slow service Hibernate

Body:
My project requires a service that will repeatable migration between two tables on two different databases. I have implemented this via Hibernate. So, I have a service that fetches data from the primary database table and then migrate it to the second database table, however, my primary database table has over 200000 rows and the iterator takes quite a long time to complete the task.

What should I use to speed up the process?

Here is the Service code:

@Service
public class TrmInCardClientService {

    @Autowired
    TrmInCardClientDBRepository trmInCardClientDBRepository;
    @Autowired
    TrmInCardClientUKMRepository trmInCardClientUKMRepository;
    private Logger log = Logger.getLogger(TrmInCardClientService.class.getName());

    public TrmInCardClientService() {
    }

    @Scheduled(
            fixedRate = 300000
    )
    public void updatelist() {
        this.log.info("TrmInCardClient data transfer start");
        try {
            Iterable<TrmInCardClientUKM> trmInCardClientUKMS = this.trmInCardClientUKMRepository.findByDeleted(0);
            List<TrmInCardClientUKM> trmInCardClientUKMList = new ArrayList();
            List<TrmInCardClientDB> trmInCardClientDBList = new ArrayList<>();
            Iterator var5 = trmInCardClientUKMS.iterator();

            while (var5.hasNext()) {
                TrmInCardClientUKM cardClientUKM = (TrmInCardClientUKM) var5.next();
                trmInCardClientUKMList.add(cardClientUKM);
                trmInCardClientDBList.add(new TrmInCardClientDB(cardClientUKM.getCard(), cardClientUKM.getClient(),
                        cardClientUKM.getDeleted(), cardClientUKM.getGlobal_id(), cardClientUKM.getVersion()));
            }

            this.trmInCardClientDBRepository.saveAll(trmInCardClientDBList);
            this.log.info("TrmInCardClient data transfer end");
        }
        catch (Exception e) {
            this.log.warning("Error encountered during TrmInCardClient data migration");
        }
    }
}


问:
Request to external server is possible in MV3?
I found MV3 didn't allow to inject external scripts.
Then does Google allow to send request to my server from MV3?
Please tell me any other way if you know.

Example,

```<code>window.fetch(
  'https://my-server/update',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    credentials: 'include',
    mode: 'cors'
  }
)
</code>```

I'm using the example code in MV2.

Body:
I found MV3 didn't allow to inject external scripts.
Then does Google allow to send request to my server from MV3?
Please tell me any other way if you know.

Example,

window.fetch(
  'https://my-server/update',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    credentials: 'include',
    mode: 'cors'
  }
)

I'm using the example code in MV2.


问:
How to get private videos or unlisted videos from youtube api using flutter?
Am developing flutter application I have uploading videos as a private through the youTube API. How do we get all private or unlisted videos from YouTube API. If anyone can help me to solve this. Thanks in advance.</p>


问:
Read JSON list and load it a dataframe
My input JSON file has list of objects as below:

```<code>[
    {
        "name": "Hariharan",
        "place": "Chennai",
        "items": [
            {"item_name":"This is a book shelf", "item_level": 1},
            {"item_name":"Introduction", "item_level": 1},
            {"item_name":"ABCDEF", "item_level": 2},
            {"item_name":"grains", "item_level": 3},
            {"item_name":"market place", "item_level": 1},
            {"item_name":"Vegentables", "item_level": 1},
            {"item_name":"Fruits", "item_level": 4},
            {"item_name":"EFGHIJ", "item_level": 2},
            {"item_name":"Conclusion", "item_level": 1}
        ],
        "descriptions": [
            {"item_name": "Books"}
        ]
    }

]
</code>```

I want to read this json file and load the data into dataframe.
Dataframe columns should be name, place, items and descriptions. Both items and descriptions are again list of items.

I am able to read json

import json

```<code>with open('data/test.json', 'r', encoding='utf8') as fp:
    data = json.load(fp)

print(type(data)) is <class 'list'>
</code>```

I get an error when I try to load the list on to dataframe:

```<code>   df = pd.read_json(data)
    ValueError: Invalid file path or buffer object type: <class 'list'>
</code>```

Title: Read JSON list and load it a dataframe

Body:
My input JSON file has list of objects as below:

[
    {
        "name": "Hariharan",
        "place": "Chennai",
        "items": [
            {"item_name":"This is a book shelf", "item_level": 1},
            {"item_name":"Introduction", "item_level": 1},
            {"item_name":"ABCDEF", "item_level": 2},
            {"item_name":"grains", "item_level": 3},
            {"item_name":"market place", "item_level": 1},
            {"item_name":"Vegentables", "item_level": 1},
            {"item_name":"Fruits", "item_level": 4},
            {"item_name":"EFGHIJ", "item_level": 2},
            {"item_name":"Conclusion", "item_level": 1}
        ],
        "descriptions": [
            {"item_name": "Books"}
        ]
    }

]

I want to read this json file and load the data into dataframe.
Dataframe columns should be name, place, items and descriptions. Both items and descriptions are again list of items.

I am able to read json

import json

with open('data/test.json', 'r', encoding='utf8') as fp:
    data = json.load(fp)

print(type(data)) is <class 'list'>

I get an error when I try to load the list on to dataframe:

   df = pd.read_json(data)
    ValueError: Invalid file path or buffer object type: <class 'list'>


问:
Sourcetree : Is there a way to prevent it from being completed with an error when push from the source tree?
When I push a project on SOUSTRY, it keeps saying 'Completed with an error' and it doesn't push properly. So I found some solutions, tried them, erased them, and then downloaded them again, but this error still doesn't work. Is there anyone who can solve this error?enter image description here

I downloaded sourcetree again, but the error is remain the same.


问:
Promise Returned By getRunningQueryThunk does not sync with actual useQuery function in RTKQ
I think the promise Returned By getRunningQueryThunk does not sync with actual useQuery life cycle in RTKQ.

const args = { name: "pikachu" };

const Pokemon = () => {
  const { data } = useGetPokemonByNameQuery(args);
  const dispatch = useDispatch();

  const thunk = pokemonApi.util.getRunningQueryThunk("getPokemonByName", args);

  const promise = dispatch(thunk as any);

  console.log("promise", promise);

  if (promise) {
    throw promise;
  }

  return (
    <>

{data.species.name}

    </>
  );
};

export default function App() {
  return (

      <Suspense fallback={
loading...
}>
        <Pokemon />
      </Suspense>

  );
}
```
<p>I tried using React Suspense with RTKQ with api.util.getRunningQueryThunk method, but no matter what I do, the first value of promise is always undefined. I thought because 'useGetPokemonByNameQuery' was called before 'getRunningQueryThunk', the promise returned by dispatch(thunk) should be a promise which is pending, but it is not.</p>
<p>if I put <code>if (!data) { return <div>loading...</div>}</code> for making things work, the promise is logged with 3 times with pending phase.</p>
<pre class="lang-js prettyprint-override"><code>const args = { name: "pikachu" };

const Pokemon = () => {
  const { data } = useGetPokemonByNameQuery(args);
  const dispatch = useDispatch();

  const thunk = pokemonApi.util.getRunningQueryThunk("getPokemonByName", args);

  const promise = dispatch(thunk as any);

  console.log("promise", promise);

  if (promise) {
    throw promise;
  }

  if (!data) {
    return <div>loading...</div>;
  }

  return (
    <>
      <h3>{data.species.name}</h3>
      <img src={data.sprites.front_shiny} alt={data.species.name} />
    </>
  );
};

export default function App() {
  return (
    <div className="App">
      <Suspense fallback={<div>loading...</div>}>
        <Pokemon />
      </Suspense>
    </div>
  );
}
</code>```

here is my code sandbox link in case you need this.

https://codesandbox.io/s/jolly-rain-gclhfp?file=/src/App.tsx:522-575

I want to know if I am doing something wrong or not.

thank you.

Body:
I think the promise Returned By getRunningQueryThunk does not sync with actual useQuery life cycle in RTKQ.

const args = { name: "pikachu" };

const Pokemon = () => {
  const { data } = useGetPokemonByNameQuery(args);
  const dispatch = useDispatch();

  const thunk = pokemonApi.util.getRunningQueryThunk("getPokemonByName", args);

  const promise = dispatch(thunk as any);

  console.log("promise", promise);

  if (promise) {
    throw promise;
  }

  return (
    <>

{data.species.name}

    </>
  );
};

export default function App() {
  return (

      <Suspense fallback={
loading...
}>
        <Pokemon />
      </Suspense>

  );
}

I tried using React Suspense with RTKQ with api.util.getRunningQueryThunk method, but no matter what I do, the first value of promise is always undefined. I thought because 'useGetPokemonByNameQuery' was called before 'getRunningQueryThunk', the promise returned by dispatch(thunk) should be a promise which is pending, but it is not.

if I put if (!data) { return
loading...
} for making things work, the promise is logged with 3 times with pending phase.

const args = { name: "pikachu" };

const Pokemon = () => {
  const { data } = useGetPokemonByNameQuery(args);
  const dispatch = useDispatch();

  const thunk = pokemonApi.util.getRunningQueryThunk("getPokemonByName", args);

  const promise = dispatch(thunk as any);

  console.log("promise", promise);

  if (promise) {
    throw promise;
  }

  if (!data) {
    return
loading...
;
  }

  return (
    <>

{data.species.name}

    </>
  );
};

export default function App() {
  return (

      <Suspense fallback={
loading...
}>
        <Pokemon />
      </Suspense>

  );
}

here is my code sandbox link in case you need this.

https://codesandbox.io/s/jolly-rain-gclhfp?file=/src/App.tsx:522-575

I want to know if I am doing something wrong or not.

thank you.


问:
Page animation in WPF Slide In and Out
So I am developing a WPF application. I am kind of newbie in this area.

Idea:
I need to navigate to a new page whenever there is a interrupt.

I have implemented page navigation using Navigation service. I have entry and exit animation for few pages.

For entry animation I have used page triggers and loaded routed event

For Page exit animation:
I store the exit animation in storyboard in page resources.
Before navigating to next page, i check whether there is a exit animation storyboard, if available, begin storyboard and in storyboard completed event , I navigate the page.

The main page has the frame and other page is navigated in the frame. Whenever i receive interrupts through events I use:

frame.Navigate(targetPage);

One the Page's XAML (Lets say Page A) looks like this

```<code><Page.Resources>
    <system:Double x:Key="SlideOffSet">800</system:Double>
    <Storyboard x:Key = "ExitAnimation">
            <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                             From="0" To="{StaticResource SlideOffSet}"
                             Duration="0:0:1" />
    </Storyboard>
</Page.Resources>
<Page.RenderTransform>
    <TranslateTransform X="{StaticResource SlideOffSet}" Y="0" />
</Page.RenderTransform>
<Page.Triggers>
    <EventTrigger RoutedEvent="Page.Loaded">
        <BeginStoryboard>
            <Storyboard>
                    <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                     From="{StaticResource SlideOffSet}" To="0"
                                     Duration="0:0:2" Completed="Timeline_OnCompleted"/>
            </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</Page.Triggers>
</code>```

Code behind of the Main Page looks like :

in the interrupt received event:
Code flow is

Eventargs contains the TargetPage Object

check for whether animation is present or not. If not present navigate to TargetPage

if exit animate is present

```<code>topage = e.MyEventString; // obtained as event args
currentPage = frame.Content as Page;
 sb = (Storyboard)currentPage.TryFindResource("ExitAnimation");
               if (sb != null)
                {
                    if (isAnimating == false)
                    {
                        isAnimating = true;
                        sb.Completed += Sb_Completed1;
                        sb.Begin(currentPage);
                    }
                }
            else{

                   this.frame.Navigate(topage);
               }
</code>```

completed event looks like

```<code>private void Sb_Completed1(object? sender, EventArgs e)
{
    isAnimating = false;
    this.frame.Navigate(topage);
    sb.Completed -= Sb_Completed1;
}
</code>```

a normal log looks like this (i.e when an interrupt is received after entry animation is completed) :

```<code>07:18:23:103 <1> Event received for navigation - target page : Page B
07:18:23:103 <1> Current Page is Page A
07:18:23:103 <1> No Exit animation found for Page A. Hence navigating to Page B
07:18:23:123 <1> Frame Load Completed. Page is Page B
07:18:25:133 <1> Entry Animation Completed
07:18:27:103 <1> Event received for navigation - target page : Page C
07:18:27:103 <1> Current Page is Page B
07:18:27:103 <1> Exit animation found for Page B. Starting Animation
07:18:28:213 <1> Exit animation Completed. Navigating to Page C
07:18:28:280 <1> Frame Load Completed. Page is Page C
07:18:30:133 <1> App close
</code>```

So we use appium to test our navigation.
Issue here is
whenever there is a ongoing animation initiated at load event and i receive a interrupt at the same time, I try to do exit animation when previous animation is ongoing on the same page.

Sometimes, the entry animation doesn't get completed and also looks like entry animation doesn't start and hence page is not navigated.

error log looks like (when an interrupt is received when entry animation is ongoing)

```<code>07:18:23:103 <1> Event received for navigation - target page : Page B
07:18:23:103 <1> Current Page is Page A
07:18:23:103 <1> No Exit animation found for Page A. Hence navigating to Page B
07:18:23:123 <1> Frame Load Completed. Page is Page B
07:18:23:133 <1> Event received for navigation - target page : Page C
07:18:23:133 <1> Current Page is Page B
07:18:23:133 <1> Exit animation found for Page B. Starting Animation
07:18:32:133 <1> App close
</code>```

--> Seems like Entry animation is not completed ! and exit animation didnt begin/ completed ???

I tried using compose handoffbehaviour for exit animation :

```<code>
sb.Begin(currentPage,HandoffBehavior.Compose);

</code>```

looks like entry animation gets completed now but exit animation is not and hence page is not navigated

```<code>07:18:23:103 <1> Event received for navigation - target page : Page B
07:18:23:103 <1> Current Page is Page A
07:18:23:103 <1> No Exit animation found for Page A. Hence navigating to Page B
07:18:23:123 <1> Frame Load Completed. Page is Page B
07:18:24:133 <1> Event received for navigation - target page : Page C
07:18:24:133 <1> Current Page is Page B
07:18:24:133 <1> Exit animation found for Page B. Starting Animation
07:18:25:133 <1> Entry Animation Completed
07:18:32:133 <1> App close
</code>```

--> Seems like Exit animation is not getting fired / completed?!

How can i solve this problem . Any help would be appreciated.`

Title: Page animation in WPF Slide In and Out

Body:
So I am developing a WPF application. I am kind of newbie in this area.

Idea:
I need to navigate to a new page whenever there is a interrupt.

I have implemented page navigation using Navigation service. I have entry and exit animation for few pages.

For entry animation I have used page triggers and loaded routed event

For Page exit animation:
I store the exit animation in storyboard in page resources.
Before navigating to next page, i check whether there is a exit animation storyboard, if available, begin storyboard and in storyboard completed event , I navigate the page.

The main page has the frame and other page is navigated in the frame. Whenever i receive interrupts through events I use:

frame.Navigate(targetPage);

One the Page's XAML (Lets say Page A) looks like this

<Page.Resources>
    <system:Double x:Key="SlideOffSet">800</system:Double>
    <Storyboard x:Key = "ExitAnimation">
            <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                             From="0" To="{StaticResource SlideOffSet}"
                             Duration="0:0:1" />
    </Storyboard>
</Page.Resources>
<Page.RenderTransform>
    <TranslateTransform X="{StaticResource SlideOffSet}" Y="0" />
</Page.RenderTransform>
<Page.Triggers>
    <EventTrigger RoutedEvent="Page.Loaded">
        <BeginStoryboard>
            <Storyboard>
                    <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                     From="{StaticResource SlideOffSet}" To="0"
                                     Duration="0:0:2" Completed="Timeline_OnCompleted"/>
            </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</Page.Triggers>

Code behind of the Main Page looks like :

in the interrupt received event:
Code flow is

Eventargs contains the TargetPage Object

check for whether animation is present or not. If not present navigate to TargetPage

if exit animate is present

topage = e.MyEventString; // obtained as event args
currentPage = frame.Content as Page;
 sb = (Storyboard)currentPage.TryFindResource("ExitAnimation");
               if (sb != null)
                {
                    if (isAnimating == false)
                    {
                        isAnimating = true;
                        sb.Completed += Sb_Completed1;
                        sb.Begin(currentPage);
                    }
                }
            else{

                   this.frame.Navigate(topage);
               }

completed event looks like

private void Sb_Completed1(object? sender, EventArgs e)
{
    isAnimating = false;
    this.frame.Navigate(topage);
    sb.Completed -= Sb_Completed1;
}

a normal log looks like this (i.e when an interrupt is received after entry animation is completed) :

07:18:23:103 <1> Event received for navigation - target page : Page B
07:18:23:103 <1> Current Page is Page A
07:18:23:103 <1> No Exit animation found for Page A. Hence navigating to Page B
07:18:23:123 <1> Frame Load Completed. Page is Page B
07:18:25:133 <1> Entry Animation Completed
07:18:27:103 <1> Event received for navigation - target page : Page C
07:18:27:103 <1> Current Page is Page B
07:18:27:103 <1> Exit animation found for Page B. Starting Animation
07:18:28:213 <1> Exit animation Completed. Navigating to Page C
07:18:28:280 <1> Frame Load Completed. Page is Page C
07:18:30:133 <1> App close

So we use appium to test our navigation.
Issue here is
whenever there is a ongoing animation initiated at load event and i receive a interrupt at the same time, I try to do exit animation when previous animation is ongoing on the same page.

Sometimes, the entry animation doesn't get completed and also looks like entry animation doesn't start and hence page is not navigated.

error log looks like (when an interrupt is received when entry animation is ongoing)

07:18:23:103 <1> Event received for navigation - target page : Page B
07:18:23:103 <1> Current Page is Page A
07:18:23:103 <1> No Exit animation found for Page A. Hence navigating to Page B
07:18:23:123 <1> Frame Load Completed. Page is Page B
07:18:23:133 <1> Event received for navigation - target page : Page C
07:18:23:133 <1> Current Page is Page B
07:18:23:133 <1> Exit animation found for Page B. Starting Animation
07:18:32:133 <1> App close

--> Seems like Entry animation is not completed ! and exit animation didnt begin/ completed ???

I tried using compose handoffbehaviour for exit animation :

sb.Begin(currentPage,HandoffBehavior.Compose);

looks like entry animation gets completed now but exit animation is not and hence page is not navigated

07:18:23:103 <1> Event received for navigation - target page : Page B
07:18:23:103 <1> Current Page is Page A
07:18:23:103 <1> No Exit animation found for Page A. Hence navigating to Page B
07:18:23:123 <1> Frame Load Completed. Page is Page B
07:18:24:133 <1> Event received for navigation - target page : Page C
07:18:24:133 <1> Current Page is Page B
07:18:24:133 <1> Exit animation found for Page B. Starting Animation
07:18:25:133 <1> Entry Animation Completed
07:18:32:133 <1> App close

--> Seems like Exit animation is not getting fired / completed?!

How can i solve this problem . Any help would be appreciated.`


问:
How to reference Environment variables set in Pycharm?
This maybe a two part question.

Background:
I'm writing a script that utilizes a tool's APIs. In order to use the API, you have to obviously authenticate. I want to store my creds in environment variables that I can reference/call in my script. I know how to set the variables in Pycharm, but I don't exactly how to reference them. I was thought to maybe set the PATH in the configurations but where exactly would the PATH be if I set the environment variables in PyCharm itself?

Question 1: Can I reference the environment variables I set in Pycharm? If so, how?
Question 2: Will this involve me setting the PATH? If so, how? (in Pycharm)


问:
Why does my preview continue to crash when I use a navigation link on swift ui?
I am trying to create a code that present different dog breeds with navigation links. My issue here is when I try to tap on the dutch shepherd my preview crashes. I have not added the navigation links to the other structs because I am having issue with the dutch shepherd one. The helper section tells me that a fatal error had occurred. Why am I unable to tap on the dutch shepherd without having my preview crash? Here is my code:

CONTENT VIEW

```<code>import SwiftUI

let dog: [DogSection] = Bundle.main.decode("dogdata.json")

struct DutchDetail: View {
    var body: some View {
    ForEach(dog) { section in
        NavigationLink(destination: { ForEach(dog) { item in
            HStack {
                Image("dutch_shepherd")
                Text(item.description)
            }
        }
        }) {
            Text(section.name)
        }
    }
}
}

struct HavaneseDetail: View {
var body: some View {
    List {
        VStack (alignment: .leading){
            Text("Havanese, the only dog breed native to Cuba, are vivacious and sociable companions and are especially popular with American city dwellers.")
        }
    }
}
}

struct ScottishDetail: View {
var body: some View {
    List {
        VStack (alignment: .leading){
            Text("A solidly compact dog of vivid personality, the Scottish Terrier is an independent, confident companion of high spirits. Scotties have a dignified, almost-human character.")
        }
    }
}
}

struct TosaDetail: View {
var body: some View {
    List {
        VStack (alignment: .leading){
            Text("A solidly compact dog of vivid personality, the Scottish Terrier is an independent, confident companion of high spirits. Scotties have a dignified, almost-human character.")
        }
    }
}
}

struct ContentView: View {
var body: some View {
    NavigationView {
        List {
            NavigationLink(destination: DutchDetail()) {
                HStack{
                    Image("dutch_shepherd")
                        .resizable()
                        .scaledToFit()
                    Text("Dutch Shepherd")
                }
            }

            NavigationLink(destination: HavaneseDetail()) {
                HStack {
                    Image("havanese")
                        .resizable()
                        .scaledToFit()
                    Text("Havanese")
                }
            }
            NavigationLink(destination: ScottishDetail()) {
                HStack {
                    Image("scottish_terrier")
                        .resizable()
                        .scaledToFit()
                    Text("Scottish Terrier")
                }
            }
            NavigationLink(destination: TosaDetail()) {
                HStack {
                    Image("tosa")
                        .resizable()
                        .scaledToFit()
                    Text("Tosa")
                }
                }
            }.navigationTitle("Dog List")
            .foregroundColor(.red)
        }
    }
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
    ContentView()
}
}
</code>```

HELPER

```<code>   import UIKit

extension Bundle {
func decode<T: Codable>(_ file: String) -> T {
    guard let url = self.url(forResource: file, withExtension: "json") else {
        fatalError("Failed to locate \(file) in bundle.")//THIS IS THE FATAL ERROR THAT IS GETTING HIT
    }

    guard let data = try? Data(contentsOf: url) else {
        fatalError("Failed to load \(file) from bundle.")
    }

    let decoder = JSONDecoder()

    guard let loaded = try? decoder.decode(T.self, from: data) else {
        fatalError("Failed to decode \(file) from bundle.")
    }

    return loaded
}
}
</code>```

DOG

```<code>import SwiftUI

struct DogSection : Codable, Identifiable {
var id: String
var name: String
var description: String
var imageName: String
}
</code>```

DOG DATA

```<code>import Foundation

[
{
    "id": "aa32jj887hhg55",
    "name": "Airedale Terrier",
    "description": "The Airedale stands among the world's most versatile dog breeds and has distinguished himself as hunter, athlete, and companion.",
    "imageName": "airedale_terrier"
},
{
    "id": "bb32jj887hhg77",
    "name": "American Foxhound",
    "description": "American Foxhounds are good-natured, low-maintenance hounds who get on well with kids, dogs, even cats, but come with special considerations for prospective owners.",
    "imageName": "american_foxhound"
},
{
    "id": "cc32jj887hhg66",
    "name": "Dutch Shepherd",
    "description": "The Dutch Shepherd is a lively, athletic, alert and intelligent breed, and has retained its herding instinct for which it was originally developed.",
    "imageName": "dutch_shepherd"
},
{
    "id": "dd32jj887hhg88",
    "name": "Havanese",
    "description": "Havanese, the only dog breed native to Cuba, are vivacious and sociable companions and are especially popular with American city dwellers.",
    "imageName": "havanese"
},
{
    "id": "ee32jj887hhg99",
    "name": "Leoberger",
    "description": "The Leonberger is a lush-coated giant of German origin. They have a gentle nature and serene patience and they relish the companionship of the whole family.",
    "imageName": "leonberger"
},
{
    "id": "ff32jj887hhg99",
    "name": "Mudi",
    "description": "The Mudi is an extremely versatile, intelligent, alert, agile, all-purpose Hungarian farm dog. The breed is a loyal protector of property and family members without being overly aggressive.",
    "imageName": "mudi"
},
{
    "id": "gg32jj887hhg99",
    "name": "Norwegian",
    "description": "From Norway’s rocky island of Vaeroy, the uniquely constructed Norwegian Lundehund is the only dog breed created for the job of puffin hunting. With puffins now a protected species, today’s Lundehund is a friendly, athletic companion.",
    "imageName": "norwegian_lundehund"
},
{
    "id": "hh32jj887hhg99",
    "name": "Pharaoh Hound ",
    "description": "The Pharaoh Hound, ancient \"Blushing Dog\" of Malta, is an elegant but rugged sprinting hound bred to course small game over punishing terrain. Quick and tenacious on scent, these friendly, affectionate hounds settle down nicely at home.",
    "imageName": "pharaoh_hound"
},
{
    "id": "ii32jj887hhg99",
    "name": "Scottish Terrier",
    "description": "A solidly compact dog of vivid personality, the Scottish Terrier is an independent, confident companion of high spirits. Scotties have a dignified, almost-human character.",
    "imageName": "scottish_terrier"
},
{
    "id": "jj32jj887hhg99",
    "name": "Tosa",
    "description": "A solidly compact dog of vivid personality, the Scottish Terrier is an independent, confident companion of high spirits. Scotties have a dignified, almost-human character.",
    "imageName": "tosa"
}
</code>```

Body:
I am trying to create a code that present different dog breeds with navigation links. My issue here is when I try to tap on the dutch shepherd my preview crashes. I have not added the navigation links to the other structs because I am having issue with the dutch shepherd one. The helper section tells me that a fatal error had occurred. Why am I unable to tap on the dutch shepherd without having my preview crash? Here is my code:

CONTENT VIEW

import SwiftUI

let dog: [DogSection] = Bundle.main.decode("dogdata.json")

struct DutchDetail: View {
    var body: some View {
    ForEach(dog) { section in
        NavigationLink(destination: { ForEach(dog) { item in
            HStack {
                Image("dutch_shepherd")
                Text(item.description)
            }
        }
        }) {
            Text(section.name)
        }
    }
}
}

struct HavaneseDetail: View {
var body: some View {
    List {
        VStack (alignment: .leading){
            Text("Havanese, the only dog breed native to Cuba, are vivacious and sociable companions and are especially popular with American city dwellers.")
        }
    }
}
}

struct ScottishDetail: View {
var body: some View {
    List {
        VStack (alignment: .leading){
            Text("A solidly compact dog of vivid personality, the Scottish Terrier is an independent, confident companion of high spirits. Scotties have a dignified, almost-human character.")
        }
    }
}
}

struct TosaDetail: View {
var body: some View {
    List {
        VStack (alignment: .leading){
            Text("A solidly compact dog of vivid personality, the Scottish Terrier is an independent, confident companion of high spirits. Scotties have a dignified, almost-human character.")
        }
    }
}
}

struct ContentView: View {
var body: some View {
    NavigationView {
        List {
            NavigationLink(destination: DutchDetail()) {
                HStack{
                    Image("dutch_shepherd")
                        .resizable()
                        .scaledToFit()
                    Text("Dutch Shepherd")
                }
            }

            NavigationLink(destination: HavaneseDetail()) {
                HStack {
                    Image("havanese")
                        .resizable()
                        .scaledToFit()
                    Text("Havanese")
                }
            }
            NavigationLink(destination: ScottishDetail()) {
                HStack {
                    Image("scottish_terrier")
                        .resizable()
                        .scaledToFit()
                    Text("Scottish Terrier")
                }
            }
            NavigationLink(destination: TosaDetail()) {
                HStack {
                    Image("tosa")
                        .resizable()
                        .scaledToFit()
                    Text("Tosa")
                }
                }
            }.navigationTitle("Dog List")
            .foregroundColor(.red)
        }
    }
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
    ContentView()
}
}

HELPER

   import UIKit

extension Bundle {
func decode<T: Codable>(_ file: String) -> T {
    guard let url = self.url(forResource: file, withExtension: "json") else {
        fatalError("Failed to locate \(file) in bundle.")//THIS IS THE FATAL ERROR THAT IS GETTING HIT
    }

    guard let data = try? Data(contentsOf: url) else {
        fatalError("Failed to load \(file) from bundle.")
    }

    let decoder = JSONDecoder()

    guard let loaded = try? decoder.decode(T.self, from: data) else {
        fatalError("Failed to decode \(file) from bundle.")
    }

    return loaded
}
}

DOG

import SwiftUI

struct DogSection : Codable, Identifiable {
var id: String
var name: String
var description: String
var imageName: String
}

DOG DATA

import Foundation

[
{
    "id": "aa32jj887hhg55",
    "name": "Airedale Terrier",
    "description": "The Airedale stands among the world's most versatile dog breeds and has distinguished himself as hunter, athlete, and companion.",
    "imageName": "airedale_terrier"
},
{
    "id": "bb32jj887hhg77",
    "name": "American Foxhound",
    "description": "American Foxhounds are good-natured, low-maintenance hounds who get on well with kids, dogs, even cats, but come with special considerations for prospective owners.",
    "imageName": "american_foxhound"
},
{
    "id": "cc32jj887hhg66",
    "name": "Dutch Shepherd",
    "description": "The Dutch Shepherd is a lively, athletic, alert and intelligent breed, and has retained its herding instinct for which it was originally developed.",
    "imageName": "dutch_shepherd"
},
{
    "id": "dd32jj887hhg88",
    "name": "Havanese",
    "description": "Havanese, the only dog breed native to Cuba, are vivacious and sociable companions and are especially popular with American city dwellers.",
    "imageName": "havanese"
},
{
    "id": "ee32jj887hhg99",
    "name": "Leoberger",
    "description": "The Leonberger is a lush-coated giant of German origin. They have a gentle nature and serene patience and they relish the companionship of the whole family.",
    "imageName": "leonberger"
},
{
    "id": "ff32jj887hhg99",
    "name": "Mudi",
    "description": "The Mudi is an extremely versatile, intelligent, alert, agile, all-purpose Hungarian farm dog. The breed is a loyal protector of property and family members without being overly aggressive.",
    "imageName": "mudi"
},
{
    "id": "gg32jj887hhg99",
    "name": "Norwegian",
    "description": "From Norway’s rocky island of Vaeroy, the uniquely constructed Norwegian Lundehund is the only dog breed created for the job of puffin hunting. With puffins now a protected species, today’s Lundehund is a friendly, athletic companion.",
    "imageName": "norwegian_lundehund"
},
{
    "id": "hh32jj887hhg99",
    "name": "Pharaoh Hound ",
    "description": "The Pharaoh Hound, ancient \"Blushing Dog\" of Malta, is an elegant but rugged sprinting hound bred to course small game over punishing terrain. Quick and tenacious on scent, these friendly, affectionate hounds settle down nicely at home.",
    "imageName": "pharaoh_hound"
},
{
    "id": "ii32jj887hhg99",
    "name": "Scottish Terrier",
    "description": "A solidly compact dog of vivid personality, the Scottish Terrier is an independent, confident companion of high spirits. Scotties have a dignified, almost-human character.",
    "imageName": "scottish_terrier"
},
{
    "id": "jj32jj887hhg99",
    "name": "Tosa",
    "description": "A solidly compact dog of vivid personality, the Scottish Terrier is an independent, confident companion of high spirits. Scotties have a dignified, almost-human character.",
    "imageName": "tosa"
}


问:
Jenkins localhost handshaking failure with AWS k8s cluster,
I am using local setup of Jenkins

I have already running AWS k8s cluster

I tried with adding kubeconfig file confuguration in Jenkins credentials

But when I try it from Jenkins Test Connection it gives me following error

Then I tried to follow the steps mentioned in StackOverflow_Ticket, even that as well giving me UnknowHostException.

Any idea what is missing ?


问:
How to prevent jspreadsheet from generating another excel each time it is executed
[[enter image description enter image description herehere](https://i.stack.imgur.com/9OaRf.png)](https://i.stack.imgur.com/iVDTH.png)
The logic is like this, every time I delete or update a set of data, I think I need to execute it again, this.$jexcel((this.$refs.excel.$el, this.sheet),How can I not generate a new excel？heple me please

i looking forward someone  help me slove the question,