问:
kivymd MDCard inside of MDBoxLayout How to put it in center
I would like to ask you what is the issue with this card can't be in center what matter I did

this is my code for that page

```<code>#:import get_color_from_hex kivy.utils.get_color_from_hex
DEMO :
   name : 'mian_screen'
   id : main_Screen
   MDBoxLayout :
      orientation : 'vertical'
      MDNavigationLayout:
           ScreenManager :
               Screen :
                   MDBoxLayout :
                       orientation :'vertical'
                       spacing :dp(10)
                       MDToolbar:
                           title: "Main Page"
                           elevation: 0
                           anchor_title: 'center'
                           radius :dp(10)
                           md_bg_color: app.theme_cls.primary_dark
                           specific_text_color : app.specific_text_color
                           left_action_items:[['menu', lambda x: nav_drawer.set_state("open")]]
                        MDCard:
                            pos:250,250
                            size_hint:(.7,.5)
                            post_hint:{'center_x':.1,'center_y':.5}
                            md_bg_color: [0.3,0.3,0.8,0.5]
                            elevation: 40
                            Image:
                                source:'Image/leaf.png'
                            MDLabel:
                                text:"image"
                                halign:"center"
                        MDLabel:
                            text:"comment"
                            post_hint:{'center_x':.5,'center_y':.5}
</code>```

image attached show what i'm trying to do and where i want my card be
image

i use pos to put it in center i played with post_hint center_x didn't work i change the Boxlayout to floatlyou get stuff inside of each other

Body:
I would like to ask you what is the issue with this card can't be in center what matter I did

this is my code for that page

#:import get_color_from_hex kivy.utils.get_color_from_hex
DEMO :
   name : 'mian_screen'
   id : main_Screen
   MDBoxLayout :
      orientation : 'vertical'
      MDNavigationLayout:
           ScreenManager :
               Screen :
                   MDBoxLayout :
                       orientation :'vertical'
                       spacing :dp(10)
                       MDToolbar:
                           title: "Main Page"
                           elevation: 0
                           anchor_title: 'center'
                           radius :dp(10)
                           md_bg_color: app.theme_cls.primary_dark
                           specific_text_color : app.specific_text_color
                           left_action_items:[['menu', lambda x: nav_drawer.set_state("open")]]
                        MDCard:
                            pos:250,250
                            size_hint:(.7,.5)
                            post_hint:{'center_x':.1,'center_y':.5}
                            md_bg_color: [0.3,0.3,0.8,0.5]
                            elevation: 40
                            Image:
                                source:'Image/leaf.png'
                            MDLabel:
                                text:"image"
                                halign:"center"
                        MDLabel:
                            text:"comment"
                            post_hint:{'center_x':.5,'center_y':.5}

image attached show what i'm trying to do and where i want my card be
image

i use pos to put it in center i played with post_hint center_x didn't work i change the Boxlayout to floatlyou get stuff inside of each other


来源: stackexchange

问:
local storage in react app is removed after callback from gateway
i am developing a mern stack web app, that has payment gateway. before redirecting the client to the bank gateway page, vital datas related to authentication is stored in the local storage that keeps the client logged in.
but after the payment process is done, the process should continue with the callback to the main app. after we come back to the app, local storage is removed in some versions of google chrome and firefox.
can anyone give me a hint why that is happening?

ContentLicense: CC BY-SA 4.0


问:
simple php countdown with javascript reload
I would like this countdown to start at 10 then count down to 1, but for the user to see it in real time - this script waits 50 seconds and then shows me all the numbers (1-10). What am I doing wrong here?

```<code><body>
Countdown<br><br>
<div id="countdown">
<?php
for($i = 10; $i >= 1; $i--) {
   echo $i;
   sleep(5);
};
?>
</div>
<script>
setTimeout((document.getElementById('countdown').reload()),1000);

</script>

</body>
</code>```

I tried the above example

Body:
I would like this countdown to start at 10 then count down to 1, but for the user to see it in real time - this script waits 50 seconds and then shows me all the numbers (1-10). What am I doing wrong here?

Countdown

<?php
for($i = 10; $i >= 1; $i--) {
   echo $i;
   sleep(5);
};
?>

I tried the above example


问:
Angular: how to share pipe parameter with different components
I have a component that has a dropdown menu and a tab bar that shows different content on each tab.

I have to filter the contents of the table that is in a tab, but I don't know how can I do that.

I made the filter with the table in the same dropdown menu component to start with, but now I have to separate the contents... =(

To make the filter I used the Pipe.

component.html (with the table at the same component than others fields)

```<code>    <!-- Dropdowns -->
      <div class="row dropdowns">
        <div class="col-3">
          <h5 class="dropdown-title">Region</h5>
          <div class="dropdown">
            <select class="form-select" aria-label="Default select example" [(ngModel)]="regionSelected">
              <option selected>All</option>
              <option value="{{ region.name }}" *ngFor="let region of regions">{{ region.name }}      </option>
        </div>
      </div>

      <!-- Navigation -->
      <div class="navigation">
        <tabset (click)="changeNamePage($event)">
          <General Component Here.tab heading="General Report">G</tab>
          <tab heading="Stages">Stages Component Here.</tab>
          <tab heading="Progress" id="tab1"><progress></progress></tab> //Other component that will show with the table
          <tab heading="Pipeline">Pipeline Component Here.</tab>
          <tab heading="Won">Won Component Here.</tab>
        </tabset>
      </div>

      <!-- Talbe -->
    <table class="table">
      <thead>
        <tr>
          <th scope="col">Region</th>
          <th scope="col">Budget</th>
          <th scope="col">Closed So Far</th>
          <th scope="col"></th>
        </tr>
      </thead>
      <tbody >
        <tr *ngFor="let content of tableContent | tableFilter: regionSelected">
          <td class="region-row">{{ content.region }}</td>
          <td class="budget-row">{{ content.budget }}</td>
          <td class="closedSoFar-row">{{ content.closed }}</td>
          <td class="btn-detail"><button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalDetailBudgetReport">Detail</button></td>
        </tr>
      </tbody>
    </table>
    </div>
</code>```

component.ts

```<code>    export class SalesHeaderComponent implements OnInit {
      regions!: Region[];
      tableContent!: ProgressTableDatas[];
      regionSelected: any = "All";

      constructor(
        private dropdownService: DropdownService) {}

      ngOnInit(): void {
        this.regions = this.dropdownService.getRegions();
        this.years = this.dropdownService.getYears();
        this.tableContent = this.dropdownService.getProgressTableDatas();
      }
</code>```

table-filter.pipe

```<code>    @Pipe({
      name: 'tableFilter'
    })
    export class TableFilterPipe implements PipeTransform {

      transform(list: any[], value: string) {
       if(value && value != "All") {
          return Object.values(list).filter(selected => selected.region === value);
        } else
          return list
        }
    }
</code>```

dropdown.service

```<code>    getRegions() {
        return [
          { name: "BRAZIL" },
          { name: "CANADA" },
          { name: "CHILE" },
          { name: "MEXICO" },
          { name: "PANAMA" },
          { name: "UNITED STATES" }
        ];
      }

</code>```
```<code>getYears() {
  return [
   { date: "2022" },
   { date: "2021" }
  ]
}

getProgressTableDatas() {
 return [
  {
   "region": "BRAZIL",
   "budget": "0.00",
   "closed": "0.00"
  },
  {
   "region": "CANADA",
   "budget": "0.00",
   "closed": "0.00"
  },
  {
   "region": "CHILE",
   "budget": "0.00",
   "closed": "0.00"
   }
 ]
}
</code>```
```<code></code>```

progress.component.html

I have to put the table here and use this component in the other

```<code>    <table class="table">
      <thead>
        <tr>
          <th scope="col">Region</th>
          <th scope="col">Budget</th>
          <th scope="col">Closed So Far</th>
          <th scope="col"></th>
        </tr>
      </thead>
      <tbody >
        <tr *ngFor="let content of tableContent | tableFilter: regionSelected">
          <td class="region-row">{{ content.region }}</td>
          <td class="budget-row">{{ content.budget }}</td>
          <td class="closedSoFar-row">{{ content.closed }}</td>
          <td class="btn-detail"><button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalDetailBudgetReport">Detail</button></td>
        </tr>
      </tbody>
    </table>
</code>```

Body:
I have a component that has a dropdown menu and a tab bar that shows different content on each tab.

I have to filter the contents of the table that is in a tab, but I don't know how can I do that.

I made the filter with the table in the same dropdown menu component to start with, but now I have to separate the contents... =(

To make the filter I used the Pipe.

component.html (with the table at the same component than others fields)

Region

            <select class="form-select" aria-label="Default select example" [(ngModel)]="regionSelected">
              <option selected>All</option>
              <option value="{{ region.name }}" *ngFor="let region of regions">{{ region.name }}      </option>

        <tabset (click)="changeNamePage($event)">
          <General Component Here.tab heading="General Report">G</tab>
          <tab heading="Stages">Stages Component Here.</tab>
          <tab heading="Progress" id="tab1"><progress></progress></tab> //Other component that will show with the table
          <tab heading="Pipeline">Pipeline Component Here.</tab>
          <tab heading="Won">Won Component Here.</tab>
        </tabset>

          Region
          Budget
          Closed So Far

          {{ content.region }}
          {{ content.budget }}
          {{ content.closed }}
          <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalDetailBudgetReport">Detail</button>

component.ts

    export class SalesHeaderComponent implements OnInit {
      regions!: Region[];
      tableContent!: ProgressTableDatas[];
      regionSelected: any = "All";

      constructor(
        private dropdownService: DropdownService) {}

      ngOnInit(): void {
        this.regions = this.dropdownService.getRegions();
        this.years = this.dropdownService.getYears();
        this.tableContent = this.dropdownService.getProgressTableDatas();
      }

table-filter.pipe

    @Pipe({
      name: 'tableFilter'
    })
    export class TableFilterPipe implements PipeTransform {

      transform(list: any[], value: string) {
       if(value && value != "All") {
          return Object.values(list).filter(selected => selected.region === value);
        } else
          return list
        }
    }

dropdown.service

    getRegions() {
        return [
          { name: "BRAZIL" },
          { name: "CANADA" },
          { name: "CHILE" },
          { name: "MEXICO" },
          { name: "PANAMA" },
          { name: "UNITED STATES" }
        ];
      }

getYears() {
  return [
   { date: "2022" },
   { date: "2021" }
  ]
}

getProgressTableDatas() {
 return [
  {
   "region": "BRAZIL",
   "budget": "0.00",
   "closed": "0.00"
  },
  {
   "region": "CANADA",
   "budget": "0.00",
   "closed": "0.00"
  },
  {
   "region": "CHILE",
   "budget": "0.00",
   "closed": "0.00"
   }
 ]
}

progress.component.html

I have to put the table here and use this component in the other

          Region
          Budget
          Closed So Far

          {{ content.region }}
          {{ content.budget }}
          {{ content.closed }}
          <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalDetailBudgetReport">Detail</button>


问:
Signals django not working on ubuntu server
I have a site on the server where I work with signals.py The problem is that when I add a db file through the admin panel signals.py does not work EXACTLY ON THE SERVER on my computer everything works fine But there is another model involving signals.py and it works great

models.py The model that works

```<code>class History(models.Model):
    tg_id = models.BigIntegerField(verbose_name='Telegram ID')
    amount = models.FloatField(verbose_name='Кол-во')
    date = models.DateTimeField(verbose_name='Дата транзакции')
</code>```

Problem model

```<code>class database_sqlite3(models.Model):
    file = models.FileField(verbose_name='Файл', upload_to='db_file/',
                            help_text='Вы можете добавить сюда базу пользователей')

</code>```

app.py

```<code>from django.apps import AppConfig

class MainConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'main'
    verbose_name = "Бот"
    def ready(self):
        import main.signals
</code>```

signals.py The model that works

```<code>@receiver(post_save, sender=History)
def create_profile(sender, instance, created, **kwargs):
    if created:
        obj = User.objects.get(tg_id=int(instance.tg_id))
        wallet = obj.wallet
        if wallet == None:
            wallet = 0
        else:
            pass
        User.objects.filter(tg_id=instance.tg_id).update(wallet=wallet + instance.amount)0
</code>```

Problem model

```<code>@receiver(post_save, sender=database_sqlite3)
def create_profile(sender, instance, created, **kwargs):
    if created:
        env = Env()
        env.read_env()
        gre = psycopg2.connect(
            database=env.str('POSTGRES_DB'),
            user=env.str('POSTGRES_USER'),
            password=env.str('POSTGRES_PASSWORD'),
            host=env.str('POSTGRES_HOST'),
            port=env.str('POSTGRES_PORT')
        )
        cur_gre = gre.cursor()
        conn = sqlite3.connect(str(instance.file))
        cursor = conn.cursor()
        table_names = cursor.execute("SELECT name FROM sqlite_master WHERE type='table';").fetchall()
        table_name = []
        for i in table_names:
            table_name.append(i[0])
        if 'main_admin_bot' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_admin_bot").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_admin_bot ("tg_id","name") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_attempts' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_attempts").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_attempts ("ids","count") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_blacklist' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_blacklist").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_blacklist ("words","job") VALUES (%s,%s)'''
                    bools = None
                    if i[2] == 0:
                        bools = False
                    else:
                        bools = True
                    date = (i[1], bools)
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_channel' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_channel").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_channel ("channel_id","ids") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass

        if 'main_parse_user' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_parse_user").fetchall()
            for i in cursore:
                sql = f'''INSERT INTO main_parse_user ("user_id","group_id", "username","bio", "first_name") VALUES (%s,%s,%s,%s,%s) ON CONFLICT (user_id) DO UPDATE SET (group_id,username,bio,first_name) = (EXCLUDED.group_id,EXCLUDED.username,coalesce(main_parse_user.bio, EXCLUDED.bio),EXCLUDED.first_name)'''
                date = (i[1], i[2], i[3], i[4], i[5])
                try:
                    try:
                        cur_gre.execute(sql, date)
                    except psycopg2.errors.InvalidTextRepresentation:
                        pass
                except psycopg2.errors.InFailedSqlTransaction:
                    pass
                gre.commit()
        if 'main_token' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_token").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_token ("ids","bot_token") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_trycountuser' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_trycountuser").fetchall()
            for i in cursore:
                print(i)
                try:
                    sql = f'''INSERT INTO main_trycountuser ("ids","count") VALUES (%s,%s)'''
                    date = (int(i[1]), int(i[2]))
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_user' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_user").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_user ("tg_id" ,"username", "name" , "try_count", "activate","linkedin","language","wallet") VALUES (%s,%s,%s,%s,%s,%s,%s,%s)'''
                    bools = None
                    if i[5] == 0:
                        bools = False
                    else:
                        bools = True
                    date = (i[1], i[2], i[3], i[4], bools, i[6], i[7], i[8])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_users_db' in table_name:
            cursore = conn.execute("SELECT * FROM main_users_db").fetchall()
            for i in cursore:
                sqlz = f'''INSERT INTO main_parse_user ("user_id","group_id", "username","bio", "first_name") VALUES (%s,%s,%s,%s,%s) ON CONFLICT (user_id) DO UPDATE SET (group_id,username,bio,first_name) = (EXCLUDED.group_id,EXCLUDED.username,coalesce(main_parse_user.bio, EXCLUDED.bio),EXCLUDED.first_name)'''
                date = (i[0], i[4], i[1], str(i[2]), i[5])
                try:
                    try:
                        cur_gre.execute(sqlz, date)
                    except psycopg2.errors.InvalidTextRepresentation:
                        pass
                except psycopg2.errors.InFailedSqlTransaction:
                    pass
                gre.commit()

        if 'user_parse' in table_name:
            cursore = conn.execute("SELECT * FROM user_parse").fetchall()
            for i in cursore:
                sqlz = f'''INSERT INTO main_parse_user ("user_id","group_id", "username","bio", "first_name") VALUES (%s,%s,%s,%s,%s) ON CONFLICT (user_id) DO UPDATE SET (group_id,username,bio,first_name) = (EXCLUDED.group_id,EXCLUDED.username,coalesce(main_parse_user.bio, EXCLUDED.bio),EXCLUDED.first_name)'''
                date = (i[1], i[0], i[2], str(i[3]), i[4])
                try:
                    try:
                        cur_gre.execute(sqlz, date)
                    except psycopg2.errors.InvalidTextRepresentation:
                        pass
                except psycopg2.errors.InFailedSqlTransaction:
                    pass
                gre.commit()
        if 'main_parser' in table_name:
            cursor = conn.execute("SELECT * FROM main_parser").fetchall()
            for i in cursor:
                sql = f'''INSERT INTO main_parse_user ("user_id","group_id", "username","bio", "first_name") VALUES (%s,%s,%s,%s,%s) ON CONFLICT (user_id) DO UPDATE SET (group_id,username,bio,first_name) = (EXCLUDED.group_id,EXCLUDED.username,coalesce(main_parse_user.bio, EXCLUDED.bio),EXCLUDED.first_name)'''
                date = (i[1], i[2], i[3], i[4], i[5])
                try:
                    try:
                        cur_gre.execute(sql, date)
                    except psycopg2.errors.InvalidTextRepresentation:
                        pass
                except psycopg2.errors.InFailedSqlTransaction:
                    pass
                gre.commit()
        if 'bot_user' in table_name:
            cursor = conn.execute("SELECT * FROM bot_user").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO main_user ("tg_id", "username", "name", "try_count", "activate") VALUES (%s,%s,%s,%s,%s)'''
                    bools = None
                    if i[4] == 0:
                        bools = False
                    else:
                        bools = True
                    date = (i[0], i[1], i[2], i[3], bools)
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass

        if 'main_trypricetype' in table_name:
            cursor = conn.execute("SELECT * FROM main_trypricetype").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO "main_trypricetype" ("searchtype", "price") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_database_sqlite3' in table_name:
            cursor = conn.execute("SELECT * FROM main_database_sqlite3").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO "main_database_sqlite3" ("file") VALUES (%s)'''
                    date = (i[1],)
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_history' in table_name:
            cursor = conn.execute("SELECT * FROM main_history").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO "main_history" ("tg_id","amount","date") VALUES (%s,%s,%s)'''
                    date = (i[1], i[2], i[3])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_webapp' in table_name:
            cursor = conn.execute("SELECT * FROM main_webapp").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO "main_webapp" ("id","image","url","name","text") VALUES (%s,%s,%s,%s,%s)'''
                    date = (i[0], i[1], i[2], i[3], i[4])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        conn.close()
        os.remove(str(instance.file))

</code>```

I added to the app/init.py file but nothing worked

Body:
I have a site on the server where I work with signals.py The problem is that when I add a db file through the admin panel signals.py does not work EXACTLY ON THE SERVER on my computer everything works fine But there is another model involving signals.py and it works great

models.py The model that works

class History(models.Model):
    tg_id = models.BigIntegerField(verbose_name='Telegram ID')
    amount = models.FloatField(verbose_name='Кол-во')
    date = models.DateTimeField(verbose_name='Дата транзакции')

Problem model

class database_sqlite3(models.Model):
    file = models.FileField(verbose_name='Файл', upload_to='db_file/',
                            help_text='Вы можете добавить сюда базу пользователей')

app.py

from django.apps import AppConfig

class MainConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'main'
    verbose_name = "Бот"
    def ready(self):
        import main.signals

signals.py The model that works

@receiver(post_save, sender=History)
def create_profile(sender, instance, created, **kwargs):
    if created:
        obj = User.objects.get(tg_id=int(instance.tg_id))
        wallet = obj.wallet
        if wallet == None:
            wallet = 0
        else:
            pass
        User.objects.filter(tg_id=instance.tg_id).update(wallet=wallet + instance.amount)0

Problem model

@receiver(post_save, sender=database_sqlite3)
def create_profile(sender, instance, created, **kwargs):
    if created:
        env = Env()
        env.read_env()
        gre = psycopg2.connect(
            database=env.str('POSTGRES_DB'),
            user=env.str('POSTGRES_USER'),
            password=env.str('POSTGRES_PASSWORD'),
            host=env.str('POSTGRES_HOST'),
            port=env.str('POSTGRES_PORT')
        )
        cur_gre = gre.cursor()
        conn = sqlite3.connect(str(instance.file))
        cursor = conn.cursor()
        table_names = cursor.execute("SELECT name FROM sqlite_master WHERE type='table';").fetchall()
        table_name = []
        for i in table_names:
            table_name.append(i[0])
        if 'main_admin_bot' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_admin_bot").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_admin_bot ("tg_id","name") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_attempts' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_attempts").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_attempts ("ids","count") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_blacklist' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_blacklist").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_blacklist ("words","job") VALUES (%s,%s)'''
                    bools = None
                    if i[2] == 0:
                        bools = False
                    else:
                        bools = True
                    date = (i[1], bools)
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_channel' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_channel").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_channel ("channel_id","ids") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass

        if 'main_parse_user' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_parse_user").fetchall()
            for i in cursore:
                sql = f'''INSERT INTO main_parse_user ("user_id","group_id", "username","bio", "first_name") VALUES (%s,%s,%s,%s,%s) ON CONFLICT (user_id) DO UPDATE SET (group_id,username,bio,first_name) = (EXCLUDED.group_id,EXCLUDED.username,coalesce(main_parse_user.bio, EXCLUDED.bio),EXCLUDED.first_name)'''
                date = (i[1], i[2], i[3], i[4], i[5])
                try:
                    try:
                        cur_gre.execute(sql, date)
                    except psycopg2.errors.InvalidTextRepresentation:
                        pass
                except psycopg2.errors.InFailedSqlTransaction:
                    pass
                gre.commit()
        if 'main_token' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_token").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_token ("ids","bot_token") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_trycountuser' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_trycountuser").fetchall()
            for i in cursore:
                print(i)
                try:
                    sql = f'''INSERT INTO main_trycountuser ("ids","count") VALUES (%s,%s)'''
                    date = (int(i[1]), int(i[2]))
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_user' in table_name:
            cursore = conn.execute(f"SELECT * FROM main_user").fetchall()
            for i in cursore:
                try:
                    sql = f'''INSERT INTO main_user ("tg_id" ,"username", "name" , "try_count", "activate","linkedin","language","wallet") VALUES (%s,%s,%s,%s,%s,%s,%s,%s)'''
                    bools = None
                    if i[5] == 0:
                        bools = False
                    else:
                        bools = True
                    date = (i[1], i[2], i[3], i[4], bools, i[6], i[7], i[8])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_users_db' in table_name:
            cursore = conn.execute("SELECT * FROM main_users_db").fetchall()
            for i in cursore:
                sqlz = f'''INSERT INTO main_parse_user ("user_id","group_id", "username","bio", "first_name") VALUES (%s,%s,%s,%s,%s) ON CONFLICT (user_id) DO UPDATE SET (group_id,username,bio,first_name) = (EXCLUDED.group_id,EXCLUDED.username,coalesce(main_parse_user.bio, EXCLUDED.bio),EXCLUDED.first_name)'''
                date = (i[0], i[4], i[1], str(i[2]), i[5])
                try:
                    try:
                        cur_gre.execute(sqlz, date)
                    except psycopg2.errors.InvalidTextRepresentation:
                        pass
                except psycopg2.errors.InFailedSqlTransaction:
                    pass
                gre.commit()

        if 'user_parse' in table_name:
            cursore = conn.execute("SELECT * FROM user_parse").fetchall()
            for i in cursore:
                sqlz = f'''INSERT INTO main_parse_user ("user_id","group_id", "username","bio", "first_name") VALUES (%s,%s,%s,%s,%s) ON CONFLICT (user_id) DO UPDATE SET (group_id,username,bio,first_name) = (EXCLUDED.group_id,EXCLUDED.username,coalesce(main_parse_user.bio, EXCLUDED.bio),EXCLUDED.first_name)'''
                date = (i[1], i[0], i[2], str(i[3]), i[4])
                try:
                    try:
                        cur_gre.execute(sqlz, date)
                    except psycopg2.errors.InvalidTextRepresentation:
                        pass
                except psycopg2.errors.InFailedSqlTransaction:
                    pass
                gre.commit()
        if 'main_parser' in table_name:
            cursor = conn.execute("SELECT * FROM main_parser").fetchall()
            for i in cursor:
                sql = f'''INSERT INTO main_parse_user ("user_id","group_id", "username","bio", "first_name") VALUES (%s,%s,%s,%s,%s) ON CONFLICT (user_id) DO UPDATE SET (group_id,username,bio,first_name) = (EXCLUDED.group_id,EXCLUDED.username,coalesce(main_parse_user.bio, EXCLUDED.bio),EXCLUDED.first_name)'''
                date = (i[1], i[2], i[3], i[4], i[5])
                try:
                    try:
                        cur_gre.execute(sql, date)
                    except psycopg2.errors.InvalidTextRepresentation:
                        pass
                except psycopg2.errors.InFailedSqlTransaction:
                    pass
                gre.commit()
        if 'bot_user' in table_name:
            cursor = conn.execute("SELECT * FROM bot_user").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO main_user ("tg_id", "username", "name", "try_count", "activate") VALUES (%s,%s,%s,%s,%s)'''
                    bools = None
                    if i[4] == 0:
                        bools = False
                    else:
                        bools = True
                    date = (i[0], i[1], i[2], i[3], bools)
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass

        if 'main_trypricetype' in table_name:
            cursor = conn.execute("SELECT * FROM main_trypricetype").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO "main_trypricetype" ("searchtype", "price") VALUES (%s,%s)'''
                    date = (i[1], i[2])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_database_sqlite3' in table_name:
            cursor = conn.execute("SELECT * FROM main_database_sqlite3").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO "main_database_sqlite3" ("file") VALUES (%s)'''
                    date = (i[1],)
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_history' in table_name:
            cursor = conn.execute("SELECT * FROM main_history").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO "main_history" ("tg_id","amount","date") VALUES (%s,%s,%s)'''
                    date = (i[1], i[2], i[3])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        if 'main_webapp' in table_name:
            cursor = conn.execute("SELECT * FROM main_webapp").fetchall()
            for i in cursor:
                try:
                    sql = f'''INSERT INTO "main_webapp" ("id","image","url","name","text") VALUES (%s,%s,%s,%s,%s)'''
                    date = (i[0], i[1], i[2], i[3], i[4])
                    try:
                        try:
                            cur_gre.execute(sql, date)
                        except psycopg2.errors.InvalidTextRepresentation:
                            pass
                    except psycopg2.errors.InFailedSqlTransaction:
                        pass
                    gre.commit()
                except psycopg2.errors.UniqueViolation:
                    pass
        conn.close()
        os.remove(str(instance.file))

I added to the app/init.py file but nothing worked


问:
Jenkins build not running after a successful build the first time
So I am setting up a Jenkins job to run my Pytest project on Github, i successfully did the configuration for my Job.
this is how my custom python builder command looks like:

python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip -r requirements.txt
export CHROMEDRIVER_PATH="/Users/Nprashanth/drivers/chromedriver"
pytest -m "regression" tests/regression/regression_test.py --metadata "Scanner" HG20320005 --metadata "S/W Release" 8.5.1 --metadata "S/W Build" 6.0.1.2212091223 --headless

Please find below, my console output where it is getting stuck and not doing anything.

The first time i ran this build it ran through all my tests successfully, i am having this issue with the second time i am running this build, also even if i make a new project wiht new config i am having the same issue.
I also tried deleting the virtual jenkins directory which gets created and tried running it again but i still have the same issue


问:
nearest building with open street map
I have a csv of relevant points with latitude and longitude and trying to get the nearest
building data to each point and add a column to the csv (or panda) in python. Tried using Pyrosm and various libraries but can't seem to prune the data to get the nearest building and then add the data. Thanks
This is what I have</p>
```<code>from pyrosm import OSM
from pyrosm import get_data
import geopandas as gpd
from sklearn.neighbors import BallTree
import numpy as np
import osmnx as ox

# get rid of weird error
import shapely
import warnings
from shapely.errors import ShapelyDeprecationWarning
import csv

def get_gig_data(csv_fname):
  with open(csv_fname, "r", encoding="latin-1") as gig_records:
    for gig_record in csv.reader(gig_records):
      yield gig_record

def main():
    warnings.filterwarnings("ignore", category=ShapelyDeprecationWarning)

    chicago_osm = OSM(get_data("chicago"))

    #get a Point of Interest GeoDataFrame

    points_of_interest = chicago_osm.get_pois() #can use a custom filter if we want to filter the types, but I think no filter might be the best

    # get buildings nodes and edges
    nodes, edges = chicago_osm.get_network(nodes=True, network_type="walking")
    buildings = chicago_osm.get_buildings()
    b_cnt = len(buildings)
    G = chicago_osm.to_graph(nodes, edges)
    #nodes = get_igraph_nodes(G)

    buildings['geometry'] = buildings.centroid

    # poi_list = np.asarray([ point.coords for point in points_of_interest['geometry'] ]) #if point.geom_type == point])

    #print(poi_list.shape)

    #tree = BallTree( np.asarray([ point.coords for point in points_of_interest['geometry'] if point.geom_type == point]), metric="manhattan") #Note: the scipy implementation of manhattan/cityblock distance might be faster according to the internet bc it uses a C function
    #Read in the gig work data - I think the best way to do this will probably be with the CSV.reader with open thing because it will go line by line and save a ton of memory

    '''for i in points_of_interest:
    print('Type: ', type(i) , '  ',i)'''

    gig_fp = "data_sample.csv"
    #gig_data = gpd.read_file(gig_fp)

    iter_gig = iter(get_gig_data(gig_fp))
    next(iter_gig)

    ids=dict()
    for building in buildings.iterrows():
        #print(type(building[1][32]) , '  ', building[1][32])
        #tup = tuple(float(x) for x in [trip[17][8:-1].split()])
        ids[building[1][32]] = building

    #make the tree that determines closest POI

    #if we use the CSV reader this for loop will be done already

    for trip in iter_gig:
        # Using generator so this should be efficient memory wise.
        tup = tuple([float(x) for x in trip[17][8:-1].split() ])
        print(type(tup), '  ', tup)
        src_ids,euclidean_distance=ox.distance.nearest_nodes(G,tup)
        src_ids, euclidean_distance= ox.distance.nearest_nodes(G,tup)
        # find nearest node

    #THEN ADD THE PICKUP AND DROPOFF IDS TO THIS TUPLE AND ADD TO A NEW NP ARRAY

if __name__ == '__main__':
    main()

</code>```

Title: nearest building with open street map

Body:
I have a csv of relevant points with latitude and longitude and trying to get the nearest
building data to each point and add a column to the csv (or panda) in python. Tried using Pyrosm and various libraries but can't seem to prune the data to get the nearest building and then add the data. Thanks
This is what I have

from pyrosm import OSM
from pyrosm import get_data
import geopandas as gpd
from sklearn.neighbors import BallTree
import numpy as np
import osmnx as ox

# get rid of weird error
import shapely
import warnings
from shapely.errors import ShapelyDeprecationWarning
import csv

def get_gig_data(csv_fname):
  with open(csv_fname, "r", encoding="latin-1") as gig_records:
    for gig_record in csv.reader(gig_records):
      yield gig_record

def main():
    warnings.filterwarnings("ignore", category=ShapelyDeprecationWarning)

    chicago_osm = OSM(get_data("chicago"))

    #get a Point of Interest GeoDataFrame

    points_of_interest = chicago_osm.get_pois() #can use a custom filter if we want to filter the types, but I think no filter might be the best

    # get buildings nodes and edges
    nodes, edges = chicago_osm.get_network(nodes=True, network_type="walking")
    buildings = chicago_osm.get_buildings()
    b_cnt = len(buildings)
    G = chicago_osm.to_graph(nodes, edges)
    #nodes = get_igraph_nodes(G)

    buildings['geometry'] = buildings.centroid

    # poi_list = np.asarray([ point.coords for point in points_of_interest['geometry'] ]) #if point.geom_type == point])

    #print(poi_list.shape)

    #tree = BallTree( np.asarray([ point.coords for point in points_of_interest['geometry'] if point.geom_type == point]), metric="manhattan") #Note: the scipy implementation of manhattan/cityblock distance might be faster according to the internet bc it uses a C function
    #Read in the gig work data - I think the best way to do this will probably be with the CSV.reader with open thing because it will go line by line and save a ton of memory

    '''for i in points_of_interest:
    print('Type: ', type(i) , '  ',i)'''

    gig_fp = "data_sample.csv"
    #gig_data = gpd.read_file(gig_fp)

    iter_gig = iter(get_gig_data(gig_fp))
    next(iter_gig)

    ids=dict()
    for building in buildings.iterrows():
        #print(type(building[1][32]) , '  ', building[1][32])
        #tup = tuple(float(x) for x in [trip[17][8:-1].split()])
        ids[building[1][32]] = building

    #make the tree that determines closest POI

    #if we use the CSV reader this for loop will be done already

    for trip in iter_gig:
        # Using generator so this should be efficient memory wise.
        tup = tuple([float(x) for x in trip[17][8:-1].split() ])
        print(type(tup), '  ', tup)
        src_ids,euclidean_distance=ox.distance.nearest_nodes(G,tup)
        src_ids, euclidean_distance= ox.distance.nearest_nodes(G,tup)
        # find nearest node

    #THEN ADD THE PICKUP AND DROPOFF IDS TO THIS TUPLE AND ADD TO A NEW NP ARRAY

if __name__ == '__main__':
    main()


问:
EOF not detected right when using strtok()?
So I have a load function that reads in this comma separatedtext data

```<code>9780136019701,An Introduction to Organic Chemistry,Timberlake Karen,10,3.54,12-2008
9781506304212,Mathematics for Social Scientists,Kropko Jonathan,7,4.73,12-2015
9781506304213,Discrete Mathematics,Jonathan,15,19.73,10-2013
9780136019702,Chemotherapy,Karen,1,2.54,1-2002
9781152304222,Advanced Mathematics Techniques,Antony Smith,5,5.21,2-2007
9781506304215,Social Studies,Simon Minter,10,9.73,11-2013
</code>```

I know there are 6 properties so I read in a line and keep calling strtok to get the next token and storing it in books which is an array of struct Book which has all these properties in it.

int load(Book *books, int* numberOfBooks){
  system("cls");
  // Implement
  int bookCounter = 0;
  char c;
  char line[STRING_LENGTH];

  FILE *file = fopen("books.txt", "r");
  if (file == NULL){
    printf("Error opening file");
    exit(1);
  }

  while (!feof(file))
  {
    fgets(line, STRING_LENGTH, file);
    line[strcspn(line, "\n")] = 0;
    printf("\n%s \n", line);

    char *bookToken = strtok(line, ",");

    strcpy(books[bookCounter].isbn, bookToken);

    bookToken = strtok(NULL, ",");

    strcpy(books[bookCounter].title, bookToken);

    bookToken = strtok(NULL, ",");
    strcpy(books[bookCounter].author, bookToken);

    bookToken = strtok(NULL, ",");
    int quantity = atoi(bookToken);
    books[bookCounter].quantity = quantity;

    bookToken = strtok(NULL, ",");
    double price = atof(bookToken);
    books[bookCounter].price = price;

    bookToken = strtok(NULL, ",");
    strcpy(books[bookCounter].date, bookToken);

  }
    bookCounter++;

  }
  fclose(file);
  printf("%d", bookCounter);

  return 0;

}
```
<p>The problem is that when I call this, everything seems to be working fine (after checking with lots of print statements) however when it gets to the end of the file, it seems to get stuck on something. It doesnt just terminate when the file ends.</p>
<p>This is the print statement for every line</p>
```780136019701,An Introduction to Organic Chemistry,Timberlake Karen,10,3.54,12-2008

781506304212,Mathematics for Social Scientists,Kropko Jonathan,7,4.73,12-2015

781506304213,Discrete Mathematics,Jonathan,15,19.73,10-2013

780136019702,Chemotherapy,Karen,1,2.54,1-2002

781152304222,Advanced Mathematics Techniques,Antony Smith,5,5.21,2-2007

781506304215,Social Studies,Simon Minter,10,9.73,11-2013

781506304215

```

I didnt leave anything out, it gets stuck on this last isbn which isnt part of the file, its the last isbn printing again for some reason

Body:
So I have a load function that reads in this comma separatedtext data

9780136019701,An Introduction to Organic Chemistry,Timberlake Karen,10,3.54,12-2008
9781506304212,Mathematics for Social Scientists,Kropko Jonathan,7,4.73,12-2015
9781506304213,Discrete Mathematics,Jonathan,15,19.73,10-2013
9780136019702,Chemotherapy,Karen,1,2.54,1-2002
9781152304222,Advanced Mathematics Techniques,Antony Smith,5,5.21,2-2007
9781506304215,Social Studies,Simon Minter,10,9.73,11-2013

I know there are 6 properties so I read in a line and keep calling strtok to get the next token and storing it in books which is an array of struct Book which has all these properties in it.

int load(Book *books, int* numberOfBooks){
  system("cls");
  // Implement
  int bookCounter = 0;
  char c;
  char line[STRING_LENGTH];

  FILE *file = fopen("books.txt", "r");
  if (file == NULL){
    printf("Error opening file");
    exit(1);
  }

  while (!feof(file))
  {
    fgets(line, STRING_LENGTH, file);
    line[strcspn(line, "\n")] = 0;
    printf("\n%s \n", line);

    char *bookToken = strtok(line, ",");

    strcpy(books[bookCounter].isbn, bookToken);

    bookToken = strtok(NULL, ",");

    strcpy(books[bookCounter].title, bookToken);

    bookToken = strtok(NULL, ",");
    strcpy(books[bookCounter].author, bookToken);

    bookToken = strtok(NULL, ",");
    int quantity = atoi(bookToken);
    books[bookCounter].quantity = quantity;

    bookToken = strtok(NULL, ",");
    double price = atof(bookToken);
    books[bookCounter].price = price;

    bookToken = strtok(NULL, ",");
    strcpy(books[bookCounter].date, bookToken);

  }
    bookCounter++;

  }
  fclose(file);
  printf("%d", bookCounter);

  return 0;

}

The problem is that when I call this, everything seems to be working fine (after checking with lots of print statements) however when it gets to the end of the file, it seems to get stuck on something. It doesnt just terminate when the file ends.

This is the print statement for every line

780136019701,An Introduction to Organic Chemistry,Timberlake Karen,10,3.54,12-2008

781506304212,Mathematics for Social Scientists,Kropko Jonathan,7,4.73,12-2015

781506304213,Discrete Mathematics,Jonathan,15,19.73,10-2013

780136019702,Chemotherapy,Karen,1,2.54,1-2002

781152304222,Advanced Mathematics Techniques,Antony Smith,5,5.21,2-2007

781506304215,Social Studies,Simon Minter,10,9.73,11-2013

781506304215

I didnt leave anything out, it gets stuck on this last isbn which isnt part of the file, its the last isbn printing again for some reason


问:
ReactJS app works fine running with "npm start" but when i build the the app using "npm run build" it doesn't link with backend
error log

This error has been showing in my console from chrome.
Also note that i am using axios to fetch data from backend

.

I used "proxy": "http://localhost:8800/api" in my package.json in reactJS project and also tried to add cors in the NodeJS

But it really didn't changed the access link!


问:
PHP Function not adding value to array
I want to have a $debugger[] array to debug my php code. I want to display the values stored in this array to the javascript console log. I made a simple function to add elements to the $debugger[] array. [PROBLEM] Unfortunately, anything I pass to the function is not being added to the array, but if I add values to the array OUTSIDE of the function, the array accepts those values. Here is a small snippit of code that is not working. What do I need to change?

`

```<code>[ABOVE PHP]
$debugger = [];
function addToDebugger($p_value)
    {
    $debugger[] = $p_value;
    }
addToDebugger('testa');
addToDebugger("testb");
addToDebugger("testc");
addToDebugger("testd");
    $debugger[] = 'test2';
    $debugger[] = 'test3';
.
.
.
[BOTTOM IN JAVASCRIPT TAG]

console.log("DEBUGGING PHP [BEGINNING]");
<?PHP
//debugging php
?>
console.log('<?PHP echo count($debugger); ?>');
<?PHP
for($i=0;$i<count($debugger);$i++)
    {
    ?>
    console.log('<?PHP echo $debugger[$i]; ?>');
    <?PHP
    }
?>
console.log("DEBUGGING PHP [ENDING]");

</code>```

`

Thank you for your help

When trying the code above [test2, test3] get added but [testa, testb, testc, testd] do not get added.

Title: PHP Function not adding value to array

Body:
I want to have a $debugger[] array to debug my php code. I want to display the values stored in this array to the javascript console log. I made a simple function to add elements to the $debugger[] array. [PROBLEM] Unfortunately, anything I pass to the function is not being added to the array, but if I add values to the array OUTSIDE of the function, the array accepts those values. Here is a small snippit of code that is not working. What do I need to change?

`

[ABOVE PHP]
$debugger = [];
function addToDebugger($p_value)
    {
    $debugger[] = $p_value;
    }
addToDebugger('testa');
addToDebugger("testb");
addToDebugger("testc");
addToDebugger("testd");
    $debugger[] = 'test2';
    $debugger[] = 'test3';
.
.
.
[BOTTOM IN JAVASCRIPT TAG]

console.log("DEBUGGING PHP [BEGINNING]");
<?PHP
//debugging php
?>
console.log('<?PHP echo count($debugger); ?>');
<?PHP
for($i=0;$i<count($debugger);$i++)
    {
    ?>
    console.log('<?PHP echo $debugger[$i]; ?>');
    <?PHP
    }
?>
console.log("DEBUGGING PHP [ENDING]");

`

Thank you for your help

When trying the code above [test2, test3] get added but [testa, testb, testc, testd] do not get added.


问:
How to Proxy Built-In JS Object?
I want to proxy some built in object primitives in JS, for example, “Number” or “String” object wrappers. However it seems the Proxy object ends up reporting as a normal JS object when passed to some native functions.

const n = new Number(10);
const p = new Proxy(n, {});
console.log(Object.prototype.toString.bind(n)()); // [object Number]
console.log(Object.prototype.toString.bind(p)()); // [object Object]```

This is just one example where the proxy gets treated differently than its target. This different treatment seems to happen whenever the proxy is passed to a function implemented in native code.

Is it possible to get the proxied object to be treated as its target object even when passed to such functions like Object.protocol.toString?

Title: How to Proxy Built-In JS Object?

Body:
I want to proxy some built in object primitives in JS, for example, “Number” or “String” object wrappers. However it seems the Proxy object ends up reporting as a normal JS object when passed to some native functions.

const n = new Number(10);
const p = new Proxy(n, {});
console.log(Object.prototype.toString.bind(n)()); // [object Number]
console.log(Object.prototype.toString.bind(p)()); // [object Object]

This is just one example where the proxy gets treated differently than its target. This different treatment seems to happen whenever the proxy is passed to a function implemented in native code.

Is it possible to get the proxied object to be treated as its target object even when passed to such functions like Object.protocol.toString?


问:
Create iterable list from inputs in WTForms
I'm trying to take inputs from a stringfield in WTForms and iterate them to show up in an app.

The inputs seem to work just fine, separate words go into the db as separate words.

However, when I try to use jinja to display the inputs on an html page, it comes out as individual characters.

This is my code for the form, the route, and the html file.

```<code>class UserForm(FlaskForm):

    fav_movies = StringField('Favorite Movies')
    fav_games = StringField('Favorite Games')
</code>```
```<code>        if user.fav_movies:
            fav_movie_list = [fm for fm in user.fav_movies]
        else:
            fav_movie_list = []

        if user.fav_games:
            fav_games_list = [yf for yf in user.fav_games]
        else:
            fav_games_list = []
</code>```
```<code>            {% if fav_movies %}
            <p class="display-6"><strong>{{ user.name }}'s Favorite Movies</strong></p>
            <ul class="list-group list-group-flush">
                {% for fm in fav_movies %}
                <li class="list-group-item">{{ fm }}</li>
                {% endfor %}
            </ul>
            {% endif %}
            {% if fav_games %}
            <p class="display-6"><strong>{{ user.name }}'s Favorite Games</strong></p>
            <ul class="list-group list-group-flush">
                {% for fg in fav_games %}
                <li class="list-group-item">{{ fg }}</li>
                {% endfor %}
            </ul>
            {% endif %}
</code>```

I was expecting something like:

Iron Man

Hulk

Dune

Instead I got

I

r

o

n

M

a

n

H

u

l

k

D

u

n

e

Separating the words with quote or commas just added those characters to the vertical list.

Body:
I'm trying to take inputs from a stringfield in WTForms and iterate them to show up in an app.

The inputs seem to work just fine, separate words go into the db as separate words.

However, when I try to use jinja to display the inputs on an html page, it comes out as individual characters.

This is my code for the form, the route, and the html file.

class UserForm(FlaskForm):

    fav_movies = StringField('Favorite Movies')
    fav_games = StringField('Favorite Games')

        if user.fav_movies:
            fav_movie_list = [fm for fm in user.fav_movies]
        else:
            fav_movie_list = []

        if user.fav_games:
            fav_games_list = [yf for yf in user.fav_games]
        else:
            fav_games_list = []

            {% if fav_movies %}

{{ user.name }}'s Favorite Movies

                {% for fm in fav_movies %}

{{ fm }}

                {% endfor %}

            {% endif %}
            {% if fav_games %}

{{ user.name }}'s Favorite Games

                {% for fg in fav_games %}

{{ fg }}

                {% endfor %}

            {% endif %}

I was expecting something like:

Iron Man

Hulk

Dune

Instead I got

I

r

o

n

M

a

n

H

u

l

k

D

u

n

e

Separating the words with quote or commas just added those characters to the vertical list.


问:
How to delete a folder on appx uninstall
I have a desktop bridge application that is packaged as an appx for the Microsoft Store. The application utilizes the WebView2 browser engine, which is part of OS and not part of the package. The Webview2 browser cache specific to this application is outside the appx installation location. The location is not virtualized to the package (because Webview2 cannot write there). I would like to remove this folder when the appx package is uninstalled. I am assuming there is something I need to add to my appxmanifest.xml to get this done, perhaps in the <Extensions> block.  Also, my application is not developed in Visual Studio and I am creating my appxmanifest.xml file manually.

So the question is: Is it possible to perform a task (e.g. delete a folder) upon uninstall of an Appx Package, and how?


问:
Oracle SQL Developer Status Error Failure -Test failed: IO Error: The Network Adapter could not establish the connection on linux (Ubuntu)
I recently switched to ubuntu and when I installed and tried to create a connection on Oracle SQL Developers 22.2.1 I get a error
Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection
Ive tried changing the ports and switching between JDK 19,17 and 11 non of them seem to fix the error, all the guides that i can find on this error seem to be specifically for windows.

any help is appreciated and apologies if I have couldnt explain my problem clearly.

Testing connection of server should produce successful but its giving  Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection


问:
Click on MUI Select dropdown padding automatically add to the body
I faced an issue when I click on MUI Select dropdown the padding automatically add to the body. I add disableScrollLock={ true } in the Menuprop the I add menu prop to Select tag but still faced the issue...Please, Provide me better solution

I implement a MUI Multi Select dropdown when I Click on Select Dropdown padding automatically add in the body

Here is the code...

```<code>import * as React from 'react';
import MenuItem from '@mui/material/MenuItem';
import ListItemText from '@mui/material/ListItemText';
import Select from '@mui/material/Select';
import TextField from '@mui/material/TextField';
import InputAdornment from '@mui/material/InputAdornment';
import Checkbox from '@mui/material/Checkbox';
import SearchIcon from "@mui/icons-material/Search";
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import ListItemIcon from "@material-ui/core/ListItemIcon";
import { makeStyles } from "@material-ui/core/styles";

const ITEM_HEIGHT = 50;
const ITEM_PADDING_TOP = 8;
const MenuProps = {
  PaperProps: {
    sx: {
      maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,
      width:220,
      fontSize:'2rem'
    }
  },
};

const classes = makeStyles((theme) => ({
  formControl: {
    margin: theme.spacing(1),
    width: 300
  },
  indeterminateColor: {
    color: "#f50057"
  },
  selectAllText: {
    fontWeight: 500
  },
  selectedAll: {
    backgroundColor: "rgba(0, 0, 0, 0.08)",
    "&:hover": {
      backgroundColor: "rgba(0, 0, 0, 0.08)"
    }
  }
}));

const names = [
  'Oliver Hansen',
  'Van Henry',
  'April Tucker',
  'Ralph Hubbard',
  'Omar Alexander',
  'Carlos Abbott',
  'Miriam Wagner',
  'Bradley Wilkerson',
  'Virginia Andrews',
  'Kelly Snyder',
];
// const containsText = (text, searchText) =>
//   text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;

export default function MultipleSelectCheckmarks({id,sendDataToParentCity,sendDataToParentBrand,sendDataToParentSKUs}) {

  const [searchText, setSearchText]    = React.useState("");
  const [personName, setPersonName]    = React.useState([]);
  const [optionLength,setOptionLength] = React.useState();
  const isAllSelected = names.length > 0 && personName.length === names.length;

  const displayedOptions = names.filter((option) =>option.toLowerCase().indexOf(searchText.toLowerCase()) > -1)

  const handleChange = (event) => {

    const value = event.target.value;
    if (value[value.length - 1] === "all") {
      setPersonName(personName.length === names.length ? [] : names);
      return;
    }
    if(!value.includes(undefined))
        setPersonName(value);

    setOptionLength(value.join(',').split(',').length-1)

    if(id==1)
        sendDataToParentCity(value)
    else if(id==2)
        sendDataToParentBrand(value)
    else if(id==3)
        sendDataToParentSKUs(value)

    };

  const serachSet = (event)=>{
    setSearchText(event.target.value)
  }

  // selected.join(',').split(',').length +" "+ "Selected"
  // + " & " +selected.join(',').split(',').length-1+
  "Others"
  return (
    <div>
        <Select

        defaultValue = {'Select Brand'}
        autoWidth={true}
        style={{width: "13.4rem",height: "2.3rem",background: "white"}}
          id="search-select"
          sx={{
            '& #search-select': {
                fontSize: '13px',
             }
           }}
          multiple
          value={personName}
          onChange={handleChange}
          renderValue={(selected) =>selected.join(',').split(',').length===names.length ? "All Selected" : selected.join(',').split(',').length==1 ? selected.join(',').split(',')[0] :(selected.join(',').split(',')[0]+" & "+optionLength)  +" Others!"}
          MenuProps={MenuProps}
          onClose={() => setSearchText("")}
          IconComponent = {KeyboardArrowDownIcon}
          withAll={true}
        >
            <MenuItem  onKeyDown={e => e.stopPropagation()}>
            <TextField
              size="small"
              placeholder="Search"
              sx={{fontSize: '2rem'}}
              fullWidth
              InputProps={{
                startAdornment: (
                  <InputAdornment position="start" >
                    <SearchIcon />
                  </InputAdornment>
                )
              }}
              onChange={serachSet}
            />
          </MenuItem>

        <MenuItem value="all">
          <ListItemIcon>
            <Checkbox
              checked={isAllSelected}
              indeterminate={
                personName.length > 0 && personName.length < names.length
              }
            />
          </ListItemIcon>
          <ListItemText
            classes={{ primary: classes.selectAllText }}
            primary="Select All"
          />
        </MenuItem>

          {displayedOptions.map((name) => (
            <MenuItem key={name} value={name}>
              <Checkbox checked={personName.indexOf(name) > -1} />
              <ListItemText primary={name} />
            </MenuItem>
          ))}
        </Select>
    </div>
  );
}
</code>```

Body:
I faced an issue when I click on MUI Select dropdown the padding automatically add to the body. I add disableScrollLock={ true } in the Menuprop the I add menu prop to Select tag but still faced the issue...Please, Provide me better solution

I implement a MUI Multi Select dropdown when I Click on Select Dropdown padding automatically add in the body

Here is the code...

import * as React from 'react';
import MenuItem from '@mui/material/MenuItem';
import ListItemText from '@mui/material/ListItemText';
import Select from '@mui/material/Select';
import TextField from '@mui/material/TextField';
import InputAdornment from '@mui/material/InputAdornment';
import Checkbox from '@mui/material/Checkbox';
import SearchIcon from "@mui/icons-material/Search";
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import ListItemIcon from "@material-ui/core/ListItemIcon";
import { makeStyles } from "@material-ui/core/styles";

const ITEM_HEIGHT = 50;
const ITEM_PADDING_TOP = 8;
const MenuProps = {
  PaperProps: {
    sx: {
      maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,
      width:220,
      fontSize:'2rem'
    }
  },
};

const classes = makeStyles((theme) => ({
  formControl: {
    margin: theme.spacing(1),
    width: 300
  },
  indeterminateColor: {
    color: "#f50057"
  },
  selectAllText: {
    fontWeight: 500
  },
  selectedAll: {
    backgroundColor: "rgba(0, 0, 0, 0.08)",
    "&:hover": {
      backgroundColor: "rgba(0, 0, 0, 0.08)"
    }
  }
}));

const names = [
  'Oliver Hansen',
  'Van Henry',
  'April Tucker',
  'Ralph Hubbard',
  'Omar Alexander',
  'Carlos Abbott',
  'Miriam Wagner',
  'Bradley Wilkerson',
  'Virginia Andrews',
  'Kelly Snyder',
];
// const containsText = (text, searchText) =>
//   text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;

export default function MultipleSelectCheckmarks({id,sendDataToParentCity,sendDataToParentBrand,sendDataToParentSKUs}) {

  const [searchText, setSearchText]    = React.useState("");
  const [personName, setPersonName]    = React.useState([]);
  const [optionLength,setOptionLength] = React.useState();
  const isAllSelected = names.length > 0 && personName.length === names.length;

  const displayedOptions = names.filter((option) =>option.toLowerCase().indexOf(searchText.toLowerCase()) > -1)

  const handleChange = (event) => {

    const value = event.target.value;
    if (value[value.length - 1] === "all") {
      setPersonName(personName.length === names.length ? [] : names);
      return;
    }
    if(!value.includes(undefined))
        setPersonName(value);

    setOptionLength(value.join(',').split(',').length-1)

    if(id==1)
        sendDataToParentCity(value)
    else if(id==2)
        sendDataToParentBrand(value)
    else if(id==3)
        sendDataToParentSKUs(value)

    };

  const serachSet = (event)=>{
    setSearchText(event.target.value)
  }

  // selected.join(',').split(',').length +" "+ "Selected"
  // + " & " +selected.join(',').split(',').length-1+
  "Others"
  return (

        <Select

        defaultValue = {'Select Brand'}
        autoWidth={true}
        style={{width: "13.4rem",height: "2.3rem",background: "white"}}
          id="search-select"
          sx={{
            '& #search-select': {
                fontSize: '13px',
             }
           }}
          multiple
          value={personName}
          onChange={handleChange}
          renderValue={(selected) =>selected.join(',').split(',').length===names.length ? "All Selected" : selected.join(',').split(',').length==1 ? selected.join(',').split(',')[0] :(selected.join(',').split(',')[0]+" & "+optionLength)  +" Others!"}
          MenuProps={MenuProps}
          onClose={() => setSearchText("")}
          IconComponent = {KeyboardArrowDownIcon}
          withAll={true}
        >
            <MenuItem  onKeyDown={e => e.stopPropagation()}>
            <TextField
              size="small"
              placeholder="Search"
              sx={{fontSize: '2rem'}}
              fullWidth
              InputProps={{
                startAdornment: (
                  <InputAdornment position="start" >
                    <SearchIcon />
                  </InputAdornment>
                )
              }}
              onChange={serachSet}
            />
          </MenuItem>

        <MenuItem value="all">
          <ListItemIcon>
            <Checkbox
              checked={isAllSelected}
              indeterminate={
                personName.length > 0 && personName.length < names.length
              }
            />
          </ListItemIcon>
          <ListItemText
            classes={{ primary: classes.selectAllText }}
            primary="Select All"
          />
        </MenuItem>

          {displayedOptions.map((name) => (
            <MenuItem key={name} value={name}>
              <Checkbox checked={personName.indexOf(name) > -1} />
              <ListItemText primary={name} />
            </MenuItem>
          ))}
        </Select>

  );
}


问:
Responsive html newsletter - mobile issues when sending to different email clients
The following code has several issues when sending all Html5 newsletters I coded.
I received footer code from the client, but it seems that it doesn't work more.
Remaining parts of the newsletters works well.
I copied an empty template mail I usually use to code my htmls.

```<code>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>xxxxxx/title>
<style>

ul {
  list-style-position: inside;
  padding-left: 0;
}
    a {
    color: inherit !important;
    text-decoration: none !important;
        }
    a[x-apple-data-detectors] {
    color: inherit !important;
    text-decoration: none !important;
    font-size: inherit !important;
    font-family: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
}

    .content {
            width: 100%;
            max-width: 600px; !important
        }
/* GENERAL STYLE RESETS */
    body, #bodyTable { height:100% !important; width:100% !important; margin:0 !important; padding:0 !important; }
    table, td { border-collapse:collapse; }
    .hyphenate {
  /* Careful, this breaks the word wherever it is without a hyphen */
  overflow-wrap: break-word;
  word-wrap: break-word;

  /* Adds a hyphen where the word breaks */
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  -moz-hyphens: auto;
  hyphens: auto;
}
/*remove blue links for iOS*/
  a[x-apple-data-detectors] {color: inherit !important;text-decoration: none !important;font-size: inherit !important;font-family: inherit !important;font-weight: inherit !important;line-height: inherit !important;}
    @media only screen and (max-width: 480px) {
    /* MUESTRA ENLACE EN MOVIL */
        .bloque{width: 100%;  display: block!important; height: 40px!important; vertical-align: middle!important}
        .bloque2{width: 100%;  display: block!important; vertical-align: middle!important}
        .bloque2 table{width: 100% !important;}
        table.body {float:left;width:100% !important;padding:0;font-size:13px !important}
        .ancho{width:100% !important}
        .ancho2{width:100% !important;text-align:center !important}
        .ancho3{width:33% !important;margin-bottom:12px !important}
        .ancho3_2{width:25% !important;margin-bottom:12px !important}
        .anchotlfn{width:26% !important;margin-bottom:12px !important}
        .ancho4{width:98% !important}
        .anchon{width:50% !important}
        .separa{ padding:8px 0 !important}
        .iber{margin:20px 0 0 25% !important}
        .logo{width:40% !important}
        .logo2{width:76% !important}
        td.izqui{text-align:left !important}
        .verde{width:100% !important;font-size:14px !important}
        .gg{width:100% !important;font-size:18px !important}
        .verde2{width:100% !important;font-size:13px !important}
        .oculto{display:none !important}
        .pie{line-height:auto !important;font-size:11px !important}
        .pdtop{padding-top:10px!important}
        .pdbot{padding-bottom:10px!important}
        .pe{width:80% !important;padding-top:3px !important}
        .alto{ height:10px !important;}
        .centrado{text-align:center !important; padding:5px 0 20px 0 !important;}
        .nopad{padding-left: 0px !important}
        .izq{text-align:left !important; float:left !important}
    }
</style>

</head>
<body bgcolor="#FFFFFF" style="font-family:Arial,Helvetica,sans-serif;font-size:13px;color:#000511">
<!--[if mso]>
<table width="600" border="0" align="center" margin bgcolor="#ffffff" cellpadding="0" cellspacing="0">
  <tr>
    <td>
       <![endif]-->

<table class="content" width="100%" border="0" align="center" bgcolor="#5c881a" cellpadding="0" cellspacing="0" style="margin: 0 auto">
  <tr>
        <td bgcolor="#FFFFFF"><table width="550" border="0" cellspacing="0" cellpadding="0" class="ancho">
        <tr>
          <td width="24"> </td>
          <td width="502"><table width="75%" border="0" cellspacing="0" cellpadding="0" class="ancho" align="left">
              <tr>
                <td> </td>
              </tr>
              <tr>
               <td style="color:#262626;font-size:12px;font-family:Arial,Helvetica,sans-serif">Se non riesci a visualizzare correttamente il messaggio, clicca <a href="#" target="_blank" style="color:#000">qui</a></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
            </table></td>
        </tr>
    </table></td>
    </tr>
    <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="15" class="ancho">
        <tr>
            <td>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="img/xxx.jpg" width="100%" border="0" alt="a"></td>
                    </tr>
                    <tr>
                         <td><img src="img/bordo-top.gif" width="100%" border="0" style="display: block;"></td>
                    </tr>
                    <tr>
                        <td bgcolor="#FFFFFF">
                            <table width="100%" border="0" cellspacing="0" cellpadding="45">
                                 <tr>
                                    <td>
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td align="justify" style="color:#5c881a;font-size:16px;font-family:Arial,Helvetica,sans-serif; line-height: 23px; text-align: justify;">test
</td>
                                            </tr>
                                            </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td><img src="img/bordo.gif" width="100%" border="0" style="display: block;"></td>
                    </tr>
                    <tr>
                        <td>
                            <br>
                            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tbody>
                        <tr bgcolor="#5d881a">
                          <td width="160" height="60" valign="middle" bgcolor="#5d881a" class="bloque pdtop"
                            style="text-align: left; color:#ffffff;font-size:11px;font-family:Arial,Helvetica,sans-serif;">
                            <table border="0" cellspacing="0" cellpadding="0">
                              <tbody>
                                <tr>
                                  <td width="43"><img src="img/tel.gif"></td>
                                  <td valign="middle"
                                    style="text-align: left; color:#ffffff;font-size:11px;font-family:Arial,Helvetica,sans-serif;">
                                    xxx xxx xxx</td>
                                </tr>
                              </tbody>
                            </table>
                          </td>
                          <td width="140" height="60" valign="middle" bgcolor="#5d881a" class="bloque"
                            style="text-align: left; width:140px; color:#ffffff;font-size:11px;font-family:Arial,Helvetica,sans-serif">
                            <table border="0" cellspacing="0" cellpadding="0">
                              <tbody>
                                <tr>
                                  <td width="43"><img src="img/sito.gif"></td>
                                  <td valign="middle"
                                    style="text-align: left; color:#ffffff;font-size:11px;font-family:Arial,Helvetica,sans-serif;">
                                    <a href="" target="_blank"
                                      style="color: #ffffff; text-decoration: none">xxxxxxxxx.it</a>
                                  </td>
                                </tr>
                              </tbody>
                            </table>
                          </td>
                          <td width="255" height="60" valign="middle" bgcolor="#5d881a" class="bloque"
                            style="text-align: left; width:255px; color:#ffffff;font-size:11px;font-family:Arial,Helvetica,sans-serif" >
                            <table border="0" cellspacing="0" cellpadding="0">
                              <tbody>
                                <tr>
                                  <td width="43"><img src="img/mail.gif"></td>
                                  <td valign="middle"
                                    style="text-align: left; color:#ffffff;font-size:11px;font-family:Arial,Helvetica,sans-serif;">
                                    <a style="color: #ffffff; text-decoration: none"
                                      href="mailto:servizioclienti@iberdrola.it">servizioclienti@xxxxxxxxx.it</a>
                                  </td>
                                </tr>
                              </tbody>
                            </table>
                          </td>

                          <td height="60" width="110" valign="middle" bgcolor="#5d881a" class="bloque pdbot"
                            style="text-align: left; width:110px; color:#ffffff;font-size:11px;font-family:Arial,Helvetica,sans-serif">
                            <table border="0" cellspacing="0" cellpadding="0">
                              <tbody>
                                <tr>
                                  <td width="46"><a href="https://www.facebook.com/xxxxxxxxx/"
                                      target="_blank"><img src="img/fb.gif" border="0"></a></td>
                                  <td width="46"><a href="https://twitter.com/xxxxxxxxx" target="_blank"><img
                                        src="img/tw.gif" border="0"></a></td>
                                  <td><a href="https://www.instagram.com/xxxxxxxxx/" target="_blank"><img
                                        src="img/ig.gif" border="0"></a></td>
                                </tr>
                              </tbody>
                            </table>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                    </td>
                 </tr>
                 <tr><td><img src="img/line.gif" width="100%"></td></tr>
                <tr><td style="text-align: left; color:#ffffff;font-size:14px;font-family:Arial,Helvetica,sans-serif"><br><br>XXXXX</td></tr>
                </table>
            </td>
        </tr>
    </table></td>
  </tr>
</table>
 <!--[if (gte mso 9)|(IE)]>
                </td>
            <tr>
        </table>
    <![endif]-->
</body>
</html>

</code>```

expected mobile visualization screenshot

actual visualization when the mail is sent

Desktop visualization

Body:
The following code has several issues when sending all Html5 newsletters I coded.
I received footer code from the client, but it seems that it doesn't work more.
Remaining parts of the newsletters works well.
I copied an empty template mail I usually use to code my htmls.

<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>xxxxxx/title>

               Se non riesci a visualizzare correttamente il messaggio, clicca qui

                                                test

                                    xxx xxx xxx

                                    xxxxxxxxx.it

                                    servizioclienti@xxxxxxxxx.it

XXXXX

expected mobile visualization screenshot

actual visualization when the mail is sent

Desktop visualization


问:
Error instantiating servlet class [com.example.HelloServlet] caused by java.lang.NoClassDefFoundError: jakarta/servlet/http/HttpServlet
i am trying to learn about servlet from a tutorial  I use intellij and this is the structure of the            default project
project structure

when i try to send a request to the
HelloServlet
i get this error
error

this is the structure of the servlet
HelloServlet
and this is the pattern of the servlet in web.xml file

```<code><servlet>
    <servlet-name>home</servlet-name>
    <servlet-class>com.example.HelloServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>home</servlet-name>
    <url-pattern>/home</url-pattern>
</servlet-mapping>
</code>```

the project contain only what I did mention before
and this the URL that I am using to request the servlet

http://localhost:8080/demo2_war_exploded/home

also the init()
function does not get executed

Body:
i am trying to learn about servlet from a tutorial  I use intellij and this is the structure of the            default project
project structure

when i try to send a request to the
HelloServlet
i get this error
error

this is the structure of the servlet
HelloServlet
and this is the pattern of the servlet in web.xml file

<servlet>
    <servlet-name>home</servlet-name>
    <servlet-class>com.example.HelloServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>home</servlet-name>
    <url-pattern>/home</url-pattern>
</servlet-mapping>

the project contain only what I did mention before
and this the URL that I am using to request the servlet

http://localhost:8080/demo2_war_exploded/home

also the init()
function does not get executed


问:
passport.js || Error at Strategy.passport.use.LocalStrategy [as _verify]
I've trying to create a login using passport but I'm having some issues.

First, take a look at my code:
`

```<code>const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;

const pool = require('../database');
const helpers = require('../lib/helpers');

passport.use('local.signup', new LocalStrategy({

    usernameField: 'username',
    passwordField: 'password',
    passReqToCallback: true
}, async (req, username, password, done) => {
    const { fullname } = req.body;
    const newUser = {
        username: username,
        password: password,
        fullname
    };
    newUser.password =  await helpers.encryptPassword(password);
    const result = await pool.query('INSERT INTO users set ?', [newUser]);
    console.log(result);
}));

</code>```

`

As you can see, I'm trying to print an "OkQuery" that says that everything went perfect.

But that's not the case because of this error.

`

```<code> Error
       at Pool.query (/home/theivano/Escritorio/Personal/Practicas_Uni/TFG/myapp/node_modules/mysql/lib/Pool.js:199:23)
       at Strategy.passport.use.LocalStrategy [as _verify] (/home/theivano/Escritorio/Personal/Practicas_Uni/TFG/myapp/src/lib/passport.js:22:31),
</code>```

`
PD: the database receives the newUser correctly! I checked!

Body:
I've trying to create a login using passport but I'm having some issues.

First, take a look at my code:
`

const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;

const pool = require('../database');
const helpers = require('../lib/helpers');

passport.use('local.signup', new LocalStrategy({

    usernameField: 'username',
    passwordField: 'password',
    passReqToCallback: true
}, async (req, username, password, done) => {
    const { fullname } = req.body;
    const newUser = {
        username: username,
        password: password,
        fullname
    };
    newUser.password =  await helpers.encryptPassword(password);
    const result = await pool.query('INSERT INTO users set ?', [newUser]);
    console.log(result);
}));

`

As you can see, I'm trying to print an "OkQuery" that says that everything went perfect.

But that's not the case because of this error.

`

 Error
       at Pool.query (/home/theivano/Escritorio/Personal/Practicas_Uni/TFG/myapp/node_modules/mysql/lib/Pool.js:199:23)
       at Strategy.passport.use.LocalStrategy [as _verify] (/home/theivano/Escritorio/Personal/Practicas_Uni/TFG/myapp/src/lib/passport.js:22:31),

`
PD: the database receives the newUser correctly! I checked!


问:
Adding custom link(run javascript) to PDF files with Python
I want to add custom links with run a particular javascript code to PDF files. The reason is that, I want to show these PDF's in an Android application and when these links are clicked, I want to open another view depending on which link is clicked. What I'm referring as 'custom links' is available when editing with Adobe. Is there a solution for Python to achieve this?

Note: There is a function in PyPdf2 - addLink - but it only allows adding links to view other pages of the document.


问:
Java Agent "java.lang.UnsupportedOperationException: class redefinition failed: attempted to change method modifiers"
I am trying to change the method access modifier through an agent via javassist, however, I get an error. So, is it possible to change the access modifier via java agent and how to fix it? Is there any other way to influence the bytecode in runtime?

Agent

```<code>public static void premain(String args, Instrumentation instrumentation)
    throws ClassNotFoundException, IOException, UnmodifiableClassException, NotFoundException {

  final ClassPool pool = ClassPool.getDefault();
  pool.appendClassPath(new LoaderClassPath(Thread.currentThread().getContextClassLoader()));

  final ClassFile file = pool.get("...")
      .getClassFile();
  file.getMethod("...").setAccessFlags(AccessFlag.PUBLIC);

  ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  DataOutputStream dos = new DataOutputStream(bytes);
  file.write(dos);

  Class<?> clazz = ...;

  instrumentation.redefineClasses(new ClassDefinition(clazz, bytes.toByteArray()));
}
</code>```

MANIFEST

```<code>Manifest-Version: 1.0
Premain-Class: ...Agent
Can-Redefine-Classes: true
Can-Retransform-Classes: true
Can-Set-Native-Method-Prefix: true

</code>```

Body:
I am trying to change the method access modifier through an agent via javassist, however, I get an error. So, is it possible to change the access modifier via java agent and how to fix it? Is there any other way to influence the bytecode in runtime?

Agent

public static void premain(String args, Instrumentation instrumentation)
    throws ClassNotFoundException, IOException, UnmodifiableClassException, NotFoundException {

  final ClassPool pool = ClassPool.getDefault();
  pool.appendClassPath(new LoaderClassPath(Thread.currentThread().getContextClassLoader()));

  final ClassFile file = pool.get("...")
      .getClassFile();
  file.getMethod("...").setAccessFlags(AccessFlag.PUBLIC);

  ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  DataOutputStream dos = new DataOutputStream(bytes);
  file.write(dos);

  Class<?> clazz = ...;

  instrumentation.redefineClasses(new ClassDefinition(clazz, bytes.toByteArray()));
}

MANIFEST

Manifest-Version: 1.0
Premain-Class: ...Agent
Can-Redefine-Classes: true
Can-Retransform-Classes: true
Can-Set-Native-Method-Prefix: true


Title: Python to excel formula imputation: getting a formula across row 2 of excel across 29 columns (from H2 to AJ2)

Body:
from openpyxl import load_workbook
from openpyxl.utils import get_column_letter
wb = load_workbook('AppCount Summary.xlsx')
sh = wb.active

t = 29
stamp = ['2020-08','2020-09','2020-10','2020-11','2020-12','2021-01','2021-02','2021-03','2021-04','2021-05','2021-06','2021-07','2021-08','2021-09','2021-10',
     '2021-11','2021-12','2022-01','2022-02','2022-03','2022-04','2022-05','2022-06','2022-07','2022-08','2022-09','2022-10','2022-11','2022-12']

for c in range(8,t+1):
    for i in stamp:
        char = get_column_letter(c)
        sh[char + str(2)] = df_AppCounts_final['YM'].str.contains(i).sum()

I am only getting the last value for cell AJ1 ('2022-12') that is 1960 for H2 till AC2.

Please help. I am new to python. what is wrong with my for loop.

from openpyxl import load_workbook
from openpyxl.utils import get_column_letter
wb = load_workbook('AppCount Summary.xlsx')
sh = wb.active

t = 29
stamp = ['2020-08','2020-09','2020-10','2020-11','2020-12','2021-01','2021-02','2021-03','2021-04','2021-05','2021-06','2021-07','2021-08','2021-09','2021-10',
     '2021-11','2021-12','2022-01','2022-02','2022-03','2022-04','2022-05','2022-06','2022-07','2022-08','2022-09','2022-10','2022-11','2022-12']

for c in range(8,t+1):
    for i in stamp:
        char = get_column_letter(c)
        sh[char + str(2)] = df_AppCounts_final['YM'].str.contains(i).sum()

I am only getting the last value for cell AJ1 ('2022-12') that is 1960 for H2 till AC2.

Please help. I am new to python. what is wrong with my for loop.