问:
The following assertion was thrown while running async test code: pumpAndSettle timed out
In flutter test i have error:

The following assertion was thrown while running async test code:pumpAndSettle timed out

My test script:

```<code>testWidgets('drawer widget test', (WidgetTester tester) async {
    TestWidgetsFlutterBinding.ensureInitialized();

    await tester.runAsync(() async {
      when(operatorRepository.getCurrentSelectedOperator()).thenAnswer((_) async => operator);

      await tester.pumpWidget(MaterialApp(home: ScaffoldDrawerTest(operatorRepository)));
      expect(find.text('-1'), findsOneWidget);
      expect(find.text(''), findsOneWidget);
      expect(find.text('Warszawa'), findsNothing);
      await tester.tap(find.byType(IconButton).first);

      await tester.pumpAndSettle();
      expect(find.text('Warszawa'), findsWidgets);
      await tester.pumpAndSettle();

      await tester.tap(find.byType(ListTile).at(2));
      expect(find.text('Warszawa'), findsNothing);
    });
  });
</code>```

I try change pumpAndSettle to for (int i = 0; i < 5; i++) { await tester.pump(Duration(seconds: 1)); }

but then i to receive error

```<code>  Actual: _TextFinder:<zero widgets with text "Warszawa" (ignoring offstage widgets)>
   Which: means none were found but some were expected
</code>```

In ScaffoldDrawerTest i have Consumer and loading widget, when viewModel is loaded then i show another widgets when is widget text "Warszawa"

Body:
In flutter test i have error:

The following assertion was thrown while running async test code:pumpAndSettle timed out

My test script:

testWidgets('drawer widget test', (WidgetTester tester) async {
    TestWidgetsFlutterBinding.ensureInitialized();

    await tester.runAsync(() async {
      when(operatorRepository.getCurrentSelectedOperator()).thenAnswer((_) async => operator);

      await tester.pumpWidget(MaterialApp(home: ScaffoldDrawerTest(operatorRepository)));
      expect(find.text('-1'), findsOneWidget);
      expect(find.text(''), findsOneWidget);
      expect(find.text('Warszawa'), findsNothing);
      await tester.tap(find.byType(IconButton).first);

      await tester.pumpAndSettle();
      expect(find.text('Warszawa'), findsWidgets);
      await tester.pumpAndSettle();

      await tester.tap(find.byType(ListTile).at(2));
      expect(find.text('Warszawa'), findsNothing);
    });
  });

I try change pumpAndSettle to for (int i = 0; i < 5; i++) { await tester.pump(Duration(seconds: 1)); }

but then i to receive error

  Actual: _TextFinder:<zero widgets with text "Warszawa" (ignoring offstage widgets)>
   Which: means none were found but some were expected

In ScaffoldDrawerTest i have Consumer and loading widget, when viewModel is loaded then i show another widgets when is widget text "Warszawa"


来源: stackexchange

问:
Is there a way to use BootSplash.storyboard as. splash screen in tvOs
I have been using launvhImage as general Splash screen for for tvOS app built using react native ,
recentlly i require to constrol when i want to hide the native spalsh screen of tvOS, I am using
react-native-bootsplash to show splash screen but I am getting "Library not found for -lRNBootSplash-tvOS". I have no idea how can implement this .

I tried using package "react-native-splash-screen" but that is also not working , I have same implementation in IOS app but that iss working perfectlly .

ContentLicense: CC BY-SA 4.0


问:
How to enable verbose logging for Webpack 5?
I could not find this information from the webpack logs, and some older answers suggests --verbose flag that did not work. Webpack 5 has --stats verbose but the documentation does not tell much about it's behaviour so not sure if that gives out the full verbose output or not.


问:
Warning when adding a column to a dataframe with the same value
How can I add a column to a dataframe with the same value

I've tried

```<code>dataframe['size']=10
</code>```

or

```<code>dataframe.loc[:,'size']=10
</code>```

but this gives

```<code>A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
</code>```

Body:
How can I add a column to a dataframe with the same value

I've tried

dataframe['size']=10

or

dataframe.loc[:,'size']=10

but this gives

A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy


问:
Vue3 typescipt suggestions do not show up in template
I'm using Typescript with Vue3 (vite). It's working fine in the


问:
Spring boot web application won't connect with aws rds postgres
I'm trying to connect my local spring boot application to an aws rds. While I can perfectly connect with pgadmin or from inside IntelliJ it just isn't working inside my spring boot application on localhost. This is my spring boot config:</p>
```<code>server.error.whitelabel.enabled=false

spring.jpa.database=POSTGRESQL
spring.sql.init.platform=postgres
spring.datasource.url=jdbc:postgresql://odyxdb.c56c5slasovs.eu-west-1.rds.amazonaws.com:5432/odyxdb
spring.datasource.username=TEST
spring.datasource.password=TEST
spring.jpa.show-sql=true
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=none
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
</code>```

Body:
I'm trying to connect my local spring boot application to an aws rds. While I can perfectly connect with pgadmin or from inside IntelliJ it just isn't working inside my spring boot application on localhost. This is my spring boot config:

server.error.whitelabel.enabled=false

spring.jpa.database=POSTGRESQL
spring.sql.init.platform=postgres
spring.datasource.url=jdbc:postgresql://odyxdb.c56c5slasovs.eu-west-1.rds.amazonaws.com:5432/odyxdb
spring.datasource.username=TEST
spring.datasource.password=TEST
spring.jpa.show-sql=true
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=none
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect


问:
TLS/SSL in pgbouncer - FATAL TLS setup failed: failed to load CA
I'm trying to set up pgbouncer to require a TLS/SSL connection from the applications connecting to it, but it throws an error  "FATAL TLS setup failed: failed to load CA"

This is my pgbouncer.ini:

```<code>  [databases]
  * = host=${postgres_host} port=5432
  [pgbouncer]
  # Do not change these settings:
  listen_addr = 0.0.0.0
  auth_file = /etc/pgbouncer/userlist.txt
  auth_type = trust

  client_tls_sslmode = require
  client_tls_key_file = /etc/pgbouncer/server.key
  client_tls_cert_file = /etc/pgbouncer/server.crt

  server_tls_sslmode = verify-ca
  server_tls_ca_file = /etc/root.crt.pem

  # These are defaults and can be configured
  # please leave them as defaults if you are
  # uncertain.
  listen_port = 5432
  unix_socket_dir =
  user = postgres
  pool_mode = transaction
  max_client_conn = 100
  ignore_startup_parameters = extra_float_digits
  admin_users = postgres
  # Please add any additional settings below this line
</code>```

but running it it throws this error, which doesn't seem correct since a CA root file is not needed.

```<code>FATAL TLS setup failed: failed to load CA: No such file or directory
</code>```

p.s. It threw the error also before I had server_tlsmode = verify-ca

Body:
I'm trying to set up pgbouncer to require a TLS/SSL connection from the applications connecting to it, but it throws an error  "FATAL TLS setup failed: failed to load CA"

This is my pgbouncer.ini:

  [databases]
  * = host=${postgres_host} port=5432
  [pgbouncer]
  # Do not change these settings:
  listen_addr = 0.0.0.0
  auth_file = /etc/pgbouncer/userlist.txt
  auth_type = trust

  client_tls_sslmode = require
  client_tls_key_file = /etc/pgbouncer/server.key
  client_tls_cert_file = /etc/pgbouncer/server.crt

  server_tls_sslmode = verify-ca
  server_tls_ca_file = /etc/root.crt.pem

  # These are defaults and can be configured
  # please leave them as defaults if you are
  # uncertain.
  listen_port = 5432
  unix_socket_dir =
  user = postgres
  pool_mode = transaction
  max_client_conn = 100
  ignore_startup_parameters = extra_float_digits
  admin_users = postgres
  # Please add any additional settings below this line

but running it it throws this error, which doesn't seem correct since a CA root file is not needed.

FATAL TLS setup failed: failed to load CA: No such file or directory

p.s. It threw the error also before I had server_tlsmode = verify-ca


问:
Flutter-foreground-task: how to change the callback interval
I'm using flutter_foreground_task, and I try to change the callback interval.
I tried several things, but no one works:
In _receivePort's listening function that handles messages from onEvent::_sendPort?.send(message):

I tried to _closeReceivePort(), then _stopForegroundTask(), then _initForegroundTask with a different interval, and finally _startForegroundTask

The same without _closeReceivePort

I tried to only _initForegroundTask again with another interval and _startForegroundTask (so that it restarts)

I also tried 1, 2 and 3 in a Timer callbcak function called after the _receivePort listening function has finished (mutex protection)

For 3: the foreground task still work, but at the same interval.
For 1: I don't really understand, it seems the foreground task still runs, but my _receivePort listening function is not called anymore.

What would you advise to do change the OnEvent interval ?

Thanks for help.


问:
How to check if a QLDB result is empty using Go?
In Go, how can I check if a AWS QLDB result is empty?

In node, the following would do the trick:

```<code>txn.execute(statement).then((result: Result) => {
  const resultList: dom.Value[] = result.getResultList();
  if (resultList.length === 0) {
     // DO something
  }
)}
</code>```

I've been reading the official quick start, but examples "assumes the results are not empty":

```<code>p, err := driver.Execute(context.Background(), func(txn qldbdriver.Transaction) (interface{}, error) {
    result, err := txn.Execute("SELECT firstName, lastName, age FROM People WHERE age = 54")
    if err != nil {
        return nil, err
    }

    // Assume the result is not empty
    hasNext := result.Next(txn)
    if !hasNext && result.Err() != nil {
        return nil, result.Err()
    }

    ionBinary := result.GetCurrentData()

    temp := new(Person)
    err = ion.Unmarshal(ionBinary, temp)
    if err != nil {
        return nil, err
    }

    return *temp, nil
})
</code>```

Body:
In Go, how can I check if a AWS QLDB result is empty?

In node, the following would do the trick:

txn.execute(statement).then((result: Result) => {
  const resultList: dom.Value[] = result.getResultList();
  if (resultList.length === 0) {
     // DO something
  }
)}

I've been reading the official quick start, but examples "assumes the results are not empty":

p, err := driver.Execute(context.Background(), func(txn qldbdriver.Transaction) (interface{}, error) {
    result, err := txn.Execute("SELECT firstName, lastName, age FROM People WHERE age = 54")
    if err != nil {
        return nil, err
    }

    // Assume the result is not empty
    hasNext := result.Next(txn)
    if !hasNext && result.Err() != nil {
        return nil, result.Err()
    }

    ionBinary := result.GetCurrentData()

    temp := new(Person)
    err = ion.Unmarshal(ionBinary, temp)
    if err != nil {
        return nil, err
    }

    return *temp, nil
})


问:
custom promise function not giving me any results
I have two js files, scripts.js and utils.js. I imported a custom promise function from utils.js to scripts.js to use but I don't get any results back.

utils.js

```<code>const waitToLoadImgs = async (imgEls) => {
  const imgElsPromise = await imgEls.map((imgEl) => {
    return new Promise((resolve) => {
      imgEl.addEventListener("load", () => {
        return resolve("ok");
      });
    });
  });

  const allImgElsLoaded = await Promise.all(imgElsPromise);
  return allImgElsLoaded;
};

export { waitToLoadImgs };

</code>```

scripts.js

```<code>import {waitToLoadImgs} from "./utils.js";

const imgEls = [...document.querySelectorAll("img")];

const result = await waitToLoadImgs(imgEls);
console.log(result); // <-----Nothing in the console.

</code>```

index.js

```<code> <body>
    <img src="./assets/recycle-bin-remove-icon.svg" />
    <img src="./assets/recycle-bin-remove-icon.svg" />
    <img src="./assets/recycle-bin-remove-icon.svg" />
    <img src="./assets/recycle-bin-remove-icon.svg" />
    <img src="./assets/recycle-bin-remove-icon.svg" />
    <script src="scripts.js" type="module"></script>
 </body>
</code>```

----------UPDATE----------

I found out that if I remove const allImgElsLoaded = await Promise.all(imgElsPromise); and just return the "imgElsPromise" array. I do finally get an array of promises log out in the console but when I check all promises "PromiseResult", they are all undefined.

utils.js

```<code>const waitToLoadImgs = async (imgEls) => {
  const imgElsPromise = await imgEls.map((imgEl) => {
    return new Promise((resolve) => {
      imgEl.addEventListener("load", () => {
        resolve("ok");
      });
    });
  });

  // Removed the Promise.all
  return imgElsPromise;
};

export { waitToLoadImgs };
</code>```

scripts.js

```<code>import {waitToLoadImgs} from "./utils.js";

const imgEls = [...document.querySelectorAll("img")];

const result = await waitToLoadImgs(imgEls);
console.log(result); // <-----This time, it does log out an array of promises, but all promises "PromiseResult" are all undefined.
</code>```

Body:
I have two js files, scripts.js and utils.js. I imported a custom promise function from utils.js to scripts.js to use but I don't get any results back.

utils.js

const waitToLoadImgs = async (imgEls) => {
  const imgElsPromise = await imgEls.map((imgEl) => {
    return new Promise((resolve) => {
      imgEl.addEventListener("load", () => {
        return resolve("ok");
      });
    });
  });

  const allImgElsLoaded = await Promise.all(imgElsPromise);
  return allImgElsLoaded;
};

export { waitToLoadImgs };

scripts.js

import {waitToLoadImgs} from "./utils.js";

const imgEls = [...document.querySelectorAll("img")];

const result = await waitToLoadImgs(imgEls);
console.log(result); // <-----Nothing in the console.

index.js

----------UPDATE----------

I found out that if I remove const allImgElsLoaded = await Promise.all(imgElsPromise); and just return the "imgElsPromise" array. I do finally get an array of promises log out in the console but when I check all promises "PromiseResult", they are all undefined.

utils.js

const waitToLoadImgs = async (imgEls) => {
  const imgElsPromise = await imgEls.map((imgEl) => {
    return new Promise((resolve) => {
      imgEl.addEventListener("load", () => {
        resolve("ok");
      });
    });
  });

  // Removed the Promise.all
  return imgElsPromise;
};

export { waitToLoadImgs };

scripts.js

import {waitToLoadImgs} from "./utils.js";

const imgEls = [...document.querySelectorAll("img")];

const result = await waitToLoadImgs(imgEls);
console.log(result); // <-----This time, it does log out an array of promises, but all promises "PromiseResult" are all undefined.


问:
Font Awesome + SmartSlider Showing on Firefox and Chrome but not Safari
On https://f860ffcc56.nxcli.net/. I have a smart slider piece at the very top of the website with a simple animated Font Awesome downward chevron. On pretty much every browser (FireFox, Chrome, Arc, Brave, Edge, Opera, etc...) it is showing as expected. On Safari however it is not showing up. As far as i can tell it is not a z-index issue but i really am stumped on this one as to why it isn't working. I've tried changing the way Font Awesome is being loaded with no avail.</p>


问:
RangeError: Maximum call stack size exceeded, when router hits for the second time
Getting below exception for the router navigation when click for the second time, however there is no error for the first time click to same routerlink.

Also, when I enter url directly in the browser and press enter button it is working fine.
I checked all the modules and there is no cyclic dependency (otherwise it should have give me error for the first time).
Please help me here.

ERROR -

```<code>ERROR Error: Uncaught (in promise): RangeError: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at router.mjs:2188:27
    at Array.forEach (<anonymous>)
    at setRouterState (router.mjs:2188:19)
    at router.mjs:2188:32
    at Array.forEach (<anonymous>)
    at setRouterState (router.mjs:2188:19)
    at router.mjs:2188:32
    at Array.forEach (<anonymous>)
    at setRouterState (router.mjs:2188:19)
    at router.mjs:2188:32
    at resolvePromise (zone.js:1211:31)
    at resolvePromise (zone.js:1165:17)
    at zone.js:1278:17
    at _ZoneDelegate.invokeTask (zone.js:406:31)
    at Object.onInvokeTask (core.mjs:26194:33)
    at _ZoneDelegate.invokeTask (zone.js:405:60)
    at Zone.runTask (zone.js:178:47)
    at drainMicroTaskQueue (zone.js:585:35)
    at ZoneTask.invokeTask [as invoke] (zone.js:491:21)
    at invokeTask (zone.js:1661:18)
handleError @ core.mjs:7621
next @ core.mjs:26900
__tryOrUnsub @ Subscriber.js:183
next @ Subscriber.js:122
_next @ Subscriber.js:72
next @ Subscriber.js:49
next @ Subject.js:39
emit @ core.mjs:22729
(anonymous) @ core.mjs:26233
invoke @ zone.js:372
run @ zone.js:134
runOutsideAngular @ core.mjs:26106
onHandleError @ core.mjs:26233
handleError @ zone.js:376
runGuarded @ zone.js:147
api.microtaskDrainDone @ zone.js:1072
drainMicroTaskQueue @ zone.js:592
invokeTask @ zone.js:491
invokeTask @ zone.js:1661
globalCallback @ zone.js:1692
globalZoneAwareCallback @ zone.js:1725
Show 21 more frames
</code>```

I am using angular 14.2.9 version and below is the router constant using for main module

```<code>export const mainRoutes: Routes = [
  {
    path: '',
    redirectTo: 'home',
    pathMatch: 'full'
  },
  {
    path: '',
    component: MainComponent,
    canActivate: [AuthGuard],
    children: [
      {
        path: 'home',
        loadChildren: () => import('../home/home.module').then(m => m.HomeModule)
      },
      {
        path: 'viewers',
        loadChildren: () => import('../viewers/viewers.module').then(m => m.ViewersModule)
      },
      {
        path: 'viewers/:name',
        loadChildren: () => import('../viewers/viewers.module').then(m => m.ViewersModule)
      },
      {
        path: 'dashboards',
        loadChildren: () => import('../dashboards/dashboards.module').then(m => m.DashboardsModule)
      },
      {
        path: 'ccs-emulators',
        loadChildren: () => import('../ccs-emulator-container/ccs-emulator-container.module').then(m => m.CcsEmulatorContainerModule)
      },
      {
        path: 'ccs-emulators/:name',
        loadChildren: () => import('../ccs-emulator-container/ccs-emulator-container.module').then(m => m.CcsEmulatorContainerModule)
      },
      {
        path: 'configurations',
        loadChildren: () => import('../configurations/configurations.module').then(m => m.ConfigurationsModule)
      }
    ]
  },

];

@NgModule({
  imports: [
    RouterModule.forChild(mainRoutes)
  ],
  exports: [RouterModule]
})
export class MainRoutingModule { }
</code>```

Dashboard Routes -

```<code>export const dashboardsRoutes: Routes = [
  {
    path: '',
    component: DashboardsComponent,
    canActivate: [AuthGuard],
    children: [
      {
        path: 'sessions',
        loadChildren: () => import('../sessions-dashboard/sessions-dashboard.module').then(m => m.SessionsDashboardModule)
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(dashboardsRoutes)],
  exports: [RouterModule]
})
export class DashboardsRoutingModule { }
</code>```

AuthGaurd -

```<code>@Injectable()
export class AuthGuard implements CanActivate {
  constructor(
    private authService: AuthService,
    private router: Router
  ) { }

  canActivate(): boolean {
    if (!this.isAuthenticated()) {
      this.router.navigate(['/login']);
      return false;
    }

    return true;
  }

  private isAuthenticated(): boolean {
    return this.authService.isLoginRequired()
      ? this.authService.isLoggedIn()
      : true;
  }
}
</code>```

Console Error -

Body:
Getting below exception for the router navigation when click for the second time, however there is no error for the first time click to same routerlink.

Also, when I enter url directly in the browser and press enter button it is working fine.
I checked all the modules and there is no cyclic dependency (otherwise it should have give me error for the first time).
Please help me here.

ERROR -

ERROR Error: Uncaught (in promise): RangeError: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at router.mjs:2188:27
    at Array.forEach (<anonymous>)
    at setRouterState (router.mjs:2188:19)
    at router.mjs:2188:32
    at Array.forEach (<anonymous>)
    at setRouterState (router.mjs:2188:19)
    at router.mjs:2188:32
    at Array.forEach (<anonymous>)
    at setRouterState (router.mjs:2188:19)
    at router.mjs:2188:32
    at resolvePromise (zone.js:1211:31)
    at resolvePromise (zone.js:1165:17)
    at zone.js:1278:17
    at _ZoneDelegate.invokeTask (zone.js:406:31)
    at Object.onInvokeTask (core.mjs:26194:33)
    at _ZoneDelegate.invokeTask (zone.js:405:60)
    at Zone.runTask (zone.js:178:47)
    at drainMicroTaskQueue (zone.js:585:35)
    at ZoneTask.invokeTask [as invoke] (zone.js:491:21)
    at invokeTask (zone.js:1661:18)
handleError @ core.mjs:7621
next @ core.mjs:26900
__tryOrUnsub @ Subscriber.js:183
next @ Subscriber.js:122
_next @ Subscriber.js:72
next @ Subscriber.js:49
next @ Subject.js:39
emit @ core.mjs:22729
(anonymous) @ core.mjs:26233
invoke @ zone.js:372
run @ zone.js:134
runOutsideAngular @ core.mjs:26106
onHandleError @ core.mjs:26233
handleError @ zone.js:376
runGuarded @ zone.js:147
api.microtaskDrainDone @ zone.js:1072
drainMicroTaskQueue @ zone.js:592
invokeTask @ zone.js:491
invokeTask @ zone.js:1661
globalCallback @ zone.js:1692
globalZoneAwareCallback @ zone.js:1725
Show 21 more frames

I am using angular 14.2.9 version and below is the router constant using for main module

export const mainRoutes: Routes = [
  {
    path: '',
    redirectTo: 'home',
    pathMatch: 'full'
  },
  {
    path: '',
    component: MainComponent,
    canActivate: [AuthGuard],
    children: [
      {
        path: 'home',
        loadChildren: () => import('../home/home.module').then(m => m.HomeModule)
      },
      {
        path: 'viewers',
        loadChildren: () => import('../viewers/viewers.module').then(m => m.ViewersModule)
      },
      {
        path: 'viewers/:name',
        loadChildren: () => import('../viewers/viewers.module').then(m => m.ViewersModule)
      },
      {
        path: 'dashboards',
        loadChildren: () => import('../dashboards/dashboards.module').then(m => m.DashboardsModule)
      },
      {
        path: 'ccs-emulators',
        loadChildren: () => import('../ccs-emulator-container/ccs-emulator-container.module').then(m => m.CcsEmulatorContainerModule)
      },
      {
        path: 'ccs-emulators/:name',
        loadChildren: () => import('../ccs-emulator-container/ccs-emulator-container.module').then(m => m.CcsEmulatorContainerModule)
      },
      {
        path: 'configurations',
        loadChildren: () => import('../configurations/configurations.module').then(m => m.ConfigurationsModule)
      }
    ]
  },

];

@NgModule({
  imports: [
    RouterModule.forChild(mainRoutes)
  ],
  exports: [RouterModule]
})
export class MainRoutingModule { }

Dashboard Routes -

export const dashboardsRoutes: Routes = [
  {
    path: '',
    component: DashboardsComponent,
    canActivate: [AuthGuard],
    children: [
      {
        path: 'sessions',
        loadChildren: () => import('../sessions-dashboard/sessions-dashboard.module').then(m => m.SessionsDashboardModule)
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(dashboardsRoutes)],
  exports: [RouterModule]
})
export class DashboardsRoutingModule { }

AuthGaurd -

@Injectable()
export class AuthGuard implements CanActivate {
  constructor(
    private authService: AuthService,
    private router: Router
  ) { }

  canActivate(): boolean {
    if (!this.isAuthenticated()) {
      this.router.navigate(['/login']);
      return false;
    }

    return true;
  }

  private isAuthenticated(): boolean {
    return this.authService.isLoginRequired()
      ? this.authService.isLoggedIn()
      : true;
  }
}

Console Error -


问:
How to get custom metrics in Elastic APM?
I have setup application performance monitoring in my Nodejs Application with Elastic. I can see my metrics coming through for CPU / memory etc but can't seem to get things to work for custom metrics.

I am following their docs on adding a metric for tracking the clients connected to our web socket server but can't see the metrics in the Elastic dashboard anywhere:

I have the following code:

```<code>apm.registerMetric('ws.connections', () => socketClients.length);
</code>```

Under APM -> Services -> Metrics I am searching for ws.connections but no results are showing up.

I have releasedthe code and know everything is working as expected for APM but just seems I can't track down the custom metrics.

Any advice on where to find this or what I can do to try debug it?

Body:
I have setup application performance monitoring in my Nodejs Application with Elastic. I can see my metrics coming through for CPU / memory etc but can't seem to get things to work for custom metrics.

I am following their docs on adding a metric for tracking the clients connected to our web socket server but can't see the metrics in the Elastic dashboard anywhere:

I have the following code:

apm.registerMetric('ws.connections', () => socketClients.length);

Under APM -> Services -> Metrics I am searching for ws.connections but no results are showing up.

I have releasedthe code and know everything is working as expected for APM but just seems I can't track down the custom metrics.

Any advice on where to find this or what I can do to try debug it?


问:
How to add a if condition to rendering a JSX component
I have a JSX component that renders a button. I am trying to render one button based on the value of productItem.OutOfStock.

This is what I think the code should look like, but the output is that the 'if else statements' are being written to the screen and not being processed, what can I do to fix this?

```<code>return (
        <div>
            <h1>{category.CategoryName}</h1>
            {category.Products.map((productItem,i) => (
                <>
                    <p key={productItem.ProductId}>{productItem.ProductName}</p>

                    if(productItem.OutOfStock == true){
                    <button
                        className="snipcart-add-item"
                        data-item-id={productItem.ProductId}
                        data-item-price={productItem.Price}
                        data-item-url={productItem.ProductUrl}
                        data-item-description={productItem.Description}
                        data-item-image={productItem.ProductImageUrl}
                        data-item-name={productItem.ProductName}
                        {...dynamicProps[i]}>
                        ADD TO CART £{productItem.Price}
                    </button>
                    }
                    else {
                        <button
                            className="snipcart-add-item"
                            data-item-id={productItem.ProductId}
                            data-item-price={productItem.Price}
                            data-item-url={productItem.ProductUrl}
                            data-item-description={productItem.Description}
                            data-item-image={productItem.ProductImageUrl}
                            data-item-name={productItem.ProductName}
                            disabled="true"
                            {...dynamicProps[i]}>
                            Sorry Sold out £{productItem.Price}
                        </button>
                    }
                </>
            ))}

        </div>
    );
</code>```

Body:
I have a JSX component that renders a button. I am trying to render one button based on the value of productItem.OutOfStock.

This is what I think the code should look like, but the output is that the 'if else statements' are being written to the screen and not being processed, what can I do to fix this?

return (

{category.CategoryName}

            {category.Products.map((productItem,i) => (
                <>

{productItem.ProductName}

                    if(productItem.OutOfStock == true){
                    <button
                        className="snipcart-add-item"
                        data-item-id={productItem.ProductId}
                        data-item-price={productItem.Price}
                        data-item-url={productItem.ProductUrl}
                        data-item-description={productItem.Description}
                        data-item-image={productItem.ProductImageUrl}
                        data-item-name={productItem.ProductName}
                        {...dynamicProps[i]}>
                        ADD TO CART £{productItem.Price}
                    </button>
                    }
                    else {
                        <button
                            className="snipcart-add-item"
                            data-item-id={productItem.ProductId}
                            data-item-price={productItem.Price}
                            data-item-url={productItem.ProductUrl}
                            data-item-description={productItem.Description}
                            data-item-image={productItem.ProductImageUrl}
                            data-item-name={productItem.ProductName}
                            disabled="true"
                            {...dynamicProps[i]}>
                            Sorry Sold out £{productItem.Price}
                        </button>
                    }
                </>
            ))}

    );


问:
Spring 6.0.0 doesn't support Apache Tiles
I've been using the Spring 5.7.x (through the Spring boot 2.7.6) with Apache Tiles 3. I'm now about to migrate my application to the recently released latest version of Spring 6.0.0 (through Spring boot 3.0.0) and I realized during the migration that - TilesConfigurer class has been removed completely.

I can't find any official resource and this class has never been deprecated so I'm not sure why the entire tiles view package (org.springframework.web.servlet.view.tiles3) is missing in the latest Spring 6.0.x version as per the documentation here

https://docs.spring.io/spring-framework/docs/6.0.x/javadoc-api/index.html

Does anyone know the reason for it?


问:
How to implement kernel module for ip forwarding
I want to implement my own kernel module to replace the need of IPtables (since I need to free the space IPtables takes)
I was easily able to filter packets with my custom module but am not successful in IP forwarding.
I want the specific forwarding: I want to send a packet from A to C via B. B has my cutom module and the rule that any packet received on port 3050 it forwards to C on port 80.

I did the following:

I hooked a function to the PRE_ROUTING hook of Netfilter. In this hook I check if the packet is from port 3050, if so I save the source IP address and port and change the destination IP to C's IP address and the destination port to 80.

I hooked a function to the POST_ROUTING hook of Netfilter. In this hook I check if the destination address is C's IP address I change the source IP address to B's IP address. I then recalculate the checksum of the IP and TCP headers.

PRE_ROUTING code:
'''

```<code>if ((3050 == getDestPort(skb, ipHeader->protocol))) {
    realSrcAddr = ipHeader->saddr;
    realSrcPort = tcpHeader->dest;
    ipHeader->daddr = DEST_ADDR;
    tcpHeader->dest = 80;
    return NF_ACCEPT;
}

if (ipHeader->saddr == DEST_ADDR) {
    ipHeader->daddr = realSrcAddr;
    tcpHeader->dest = realSrcPort;
    return NF_ACCEPT;
}
</code>```

'''

POST_ROUTING code:
'''

```<code>if ((ipHeader->daddr == DEST_ADDR) || (ipHeader->saddr == DEST_ADDR)) {
    printk(KERN_INFO "src switching in fwding...");
    ipHeader->saddr = MY_ADDR;
    tcpHeader->source = MY_ADDR;
    ipHeader->check = 0;
    ipHeader->check = compute_checksum((unsigned short*)ipHeader, ipHeader->ihl<<2);
    tcpHeader->check = compute_tcp_checksum((unsigned short*)tcpHeader);
}
</code>```

'''

I see the packet is sent from B to C but C doesn't respond to it. am I missing a CRC/checksum to update? is there other stuff I need to do to implement ip forwarding? is there a HOW TO guide anywhere?

Thanks,
Robbie

Body:
I want to implement my own kernel module to replace the need of IPtables (since I need to free the space IPtables takes)
I was easily able to filter packets with my custom module but am not successful in IP forwarding.
I want the specific forwarding: I want to send a packet from A to C via B. B has my cutom module and the rule that any packet received on port 3050 it forwards to C on port 80.

I did the following:

I hooked a function to the PRE_ROUTING hook of Netfilter. In this hook I check if the packet is from port 3050, if so I save the source IP address and port and change the destination IP to C's IP address and the destination port to 80.

I hooked a function to the POST_ROUTING hook of Netfilter. In this hook I check if the destination address is C's IP address I change the source IP address to B's IP address. I then recalculate the checksum of the IP and TCP headers.

PRE_ROUTING code:
'''

if ((3050 == getDestPort(skb, ipHeader->protocol))) {
    realSrcAddr = ipHeader->saddr;
    realSrcPort = tcpHeader->dest;
    ipHeader->daddr = DEST_ADDR;
    tcpHeader->dest = 80;
    return NF_ACCEPT;
}

if (ipHeader->saddr == DEST_ADDR) {
    ipHeader->daddr = realSrcAddr;
    tcpHeader->dest = realSrcPort;
    return NF_ACCEPT;
}

'''

POST_ROUTING code:
'''

if ((ipHeader->daddr == DEST_ADDR) || (ipHeader->saddr == DEST_ADDR)) {
    printk(KERN_INFO "src switching in fwding...");
    ipHeader->saddr = MY_ADDR;
    tcpHeader->source = MY_ADDR;
    ipHeader->check = 0;
    ipHeader->check = compute_checksum((unsigned short*)ipHeader, ipHeader->ihl<<2);
    tcpHeader->check = compute_tcp_checksum((unsigned short*)tcpHeader);
}

'''

I see the packet is sent from B to C but C doesn't respond to it. am I missing a CRC/checksum to update? is there other stuff I need to do to implement ip forwarding? is there a HOW TO guide anywhere?

Thanks,
Robbie


问:
Can't name the resources folder "Resources" in my Swift package
When I use resources: [.copy("Resources")] for my Swift package, the bundle can't be built: "Command CodeSign failed with a nonzero exit code" (undle format unrecognized, invalid, or unsuitable).

When I rename the folder to something else, the package can be built without issues.

What's wrong with "Resources"?


问:
The connection to the server localhost:8080 was refused Kubernetes
I have a running Kubernetes on machine, while I want to access it by running any kubernetes releated commands (Example: sudo kubectl get nodes) I only get following error:

```<code>The connection to the server localhost:8080 was refused - did you specify the right host or port?
</code>```

Worth to mention that on this server I'm logged in as a seperate user with separatee home directory. In my home user directory I do not have .kube and it is located in the the main dir

Body:
I have a running Kubernetes on machine, while I want to access it by running any kubernetes releated commands (Example: sudo kubectl get nodes) I only get following error:

The connection to the server localhost:8080 was refused - did you specify the right host or port?

Worth to mention that on this server I'm logged in as a seperate user with separatee home directory. In my home user directory I do not have .kube and it is located in the the main dir


问:
z-index with overflow and popup inside it
I have a popup that appears when clicking on a text element, the problem is that this text is inside a container with overflow because it is a document. My problem is that when I click to make the popup appear, this popup is inside the container but it doesn't display well, and I've already tried the z-index in several ways and it doesn't work. The popup should be displayed completely and as if it were outside the container. The popup is generated by a specific library (ckeditor) and I don't have access to the code directly or to modify it.


问:
electron. All of the BrowserWindows are a same session
My code:

```<code>let w1 = new BrowserWindow();
let w2 =  new BrowserWindow();
w1.webContents.session == w2.webContents.session
</code>```

The result is true.
It's my wrong ? Is The web content's session a default session?  If so，How can i  get the different session in different browser web content?

I try to config:

```<code>let w1 = new  BrowserWindow({
    webPreferences : {  session: newSession  }
})
</code>```

when new a BrowserWindow object. But newSession.setProxy() or w1.webContents.session.setProxy() will be dose not work.

Body:
My code:

let w1 = new BrowserWindow();
let w2 =  new BrowserWindow();
w1.webContents.session == w2.webContents.session

The result is true.
It's my wrong ? Is The web content's session a default session?  If so，How can i  get the different session in different browser web content?

I try to config:

let w1 = new  BrowserWindow({
    webPreferences : {  session: newSession  }
})

when new a BrowserWindow object. But newSession.setProxy() or w1.webContents.session.setProxy() will be dose not work.


问:
Reupdate Set Orders with Custom Comparator
I'm solving a CP-like problem, that's why this question seems a little bit nonsense.

Let's say I have struct Item, and I'm storing them inside an unorderd_map. Then I keep the pointer of the map elements inside a Set that is sorted by the speed of Item.

My goal is to find out which Item has the fastest speed quickly. Here's the code:

```<code>struct Item{
    int speed;
    int id;
};

struct cmp{
    bool operator()(Item *I1, Item *I2) const{
        if(I1->speed == I2->speed) return I1->id < I2->id;
        return I1->speed > I2->speed;
    }
};

unordered_map<int, Item> MP;
set<Item*, cmp> S;

int main(){
    MP[2] = Item(2, 20);
    MP[1] = Item(1, 10);
    MP[3] = Item(3, 30);

    for(auto it = MP.begin(); it != MP.end(); ++it){
        S.insert(&it->second);
    }
    ...
}

</code>```

I tried to update the speed of an Item, but the order of the set remains the same.

With my solution, is there any way to reorder the Set when I update one of the element's speeds without clearing the Set?

I'm looking for a better solution too, thank you. :)

Body:
I'm solving a CP-like problem, that's why this question seems a little bit nonsense.

Let's say I have struct Item, and I'm storing them inside an unorderd_map. Then I keep the pointer of the map elements inside a Set that is sorted by the speed of Item.

My goal is to find out which Item has the fastest speed quickly. Here's the code:

struct Item{
    int speed;
    int id;
};

struct cmp{
    bool operator()(Item *I1, Item *I2) const{
        if(I1->speed == I2->speed) return I1->id < I2->id;
        return I1->speed > I2->speed;
    }
};

unordered_map<int, Item> MP;
set<Item*, cmp> S;

int main(){
    MP[2] = Item(2, 20);
    MP[1] = Item(1, 10);
    MP[3] = Item(3, 30);

    for(auto it = MP.begin(); it != MP.end(); ++it){
        S.insert(&it->second);
    }
    ...
}

I tried to update the speed of an Item, but the order of the set remains the same.

With my solution, is there any way to reorder the Set when I update one of the element's speeds without clearing the Set?

I'm looking for a better solution too, thank you. :)


问:
How to Build Holidify Website demo build on Wordpress
I want to make website like holidify.com and click on tab and tab change their Permalink

pls provide code to build holidify like website in wordpress


问:
I've upgrade my python to 3.11 and delete python 3.10 including pakages too. though visual studio code is showing me the suggestion of old pakages
intellisense
interpreter

☝ look these screen shots
i've tried to restart my laptop and reinstalling the python extension and all but it still same. how can i fix it ? please help !


问:
Manim animation in loop
I am creating two animations simultaneously in manim 1) square to circle and 2)square to circle but the circle in first animation won't fade out until the end of second animation.how to fade that circle out how to stop that first animation before start of second one . I have used fadeout function but circle is not fading out it remains there until the end of second animation

Is there any other way to this

Title: Manim animation in loop


问:
Rotating and translating pdfs with PyPDF2
I am trying to write a little python function. The goal is to create booklets ready for printing from typeset pdfs. The function creates A4 spreads. It should take two defined pages from an A5 input pdf, rotate them and translate them so that they are next to each other as shown here:
Illustration

I almost got it to work:

```<code>import os
os.chdir('D:\\')

from PyPDF2 import PdfFileReader, PdfFileWriter, PageObject

reader = PdfFileReader(open('My_A5_document.pdf','rb'))

# Size of an A4
new_page = PageObject.createBlankPage(None, 595, 841)

new_page.mergeRotatedTranslatedPage(reader.getPage(1), 90, 0, 0, False)
new_page.mergeRotatedTranslatedPage(reader.getPage(2), 90, 0, 0, False)

writer = PdfFileWriter()
writer.addPage(new_page)

with open('out.pdf', 'wb') as f:
    writer.write(f)
</code>```

However, the function mergeRotatedTranslatedPage is moving the body in ways I cannot understand and it takes it outside of the actual A4 page (with no translation, next to the page on the lower left side). I cannot understand if it first translates and then rotates, or the other way round. Also, which point does it rotate around? How can I get it to move properly? I.e, I am looking for the values a and b in mergeRotatedTranslatedPage(~, 90, a, b).

Body:
I am trying to write a little python function. The goal is to create booklets ready for printing from typeset pdfs. The function creates A4 spreads. It should take two defined pages from an A5 input pdf, rotate them and translate them so that they are next to each other as shown here:
Illustration

I almost got it to work:

import os
os.chdir('D:\\')

from PyPDF2 import PdfFileReader, PdfFileWriter, PageObject

reader = PdfFileReader(open('My_A5_document.pdf','rb'))

# Size of an A4
new_page = PageObject.createBlankPage(None, 595, 841)

new_page.mergeRotatedTranslatedPage(reader.getPage(1), 90, 0, 0, False)
new_page.mergeRotatedTranslatedPage(reader.getPage(2), 90, 0, 0, False)

writer = PdfFileWriter()
writer.addPage(new_page)

with open('out.pdf', 'wb') as f:
    writer.write(f)

However, the function mergeRotatedTranslatedPage is moving the body in ways I cannot understand and it takes it outside of the actual A4 page (with no translation, next to the page on the lower left side). I cannot understand if it first translates and then rotates, or the other way round. Also, which point does it rotate around? How can I get it to move properly? I.e, I am looking for the values a and b in mergeRotatedTranslatedPage(~, 90, a, b).


问:
How to create Avro Generic Records from the kafka messages in Apache Flink
I'm trying to bulk-write the Kafka messages as parquet files in s3 bucket using Apache Flink. The flink documentation suggests creating a DataStream of GenericRecord. Can someone please help me in creating the required datastream (DataStream) from Kafka messages?</p>
```<code>import org.apache.flink.connector.file.sink.FileSink;
import org.apache.flink.formats.parquet.avro.AvroParquetWriters;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;

Schema schema = ...;
DataStream<GenericRecord> input = ...;

final FileSink<GenericRecord> sink = FileSink
    .forBulkFormat(outputBasePath, AvroParquetWriters.forGenericRecord(schema))
    .build();

input.sinkTo(sink);
</code>```

Body:
I'm trying to bulk-write the Kafka messages as parquet files in s3 bucket using Apache Flink. The flink documentation suggests creating a DataStream of GenericRecord. Can someone please help me in creating the required datastream (DataStream) from Kafka messages?

import org.apache.flink.connector.file.sink.FileSink;
import org.apache.flink.formats.parquet.avro.AvroParquetWriters;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;

Schema schema = ...;
DataStream<GenericRecord> input = ...;

final FileSink<GenericRecord> sink = FileSink
    .forBulkFormat(outputBasePath, AvroParquetWriters.forGenericRecord(schema))
    .build();

input.sinkTo(sink);


问:
Office Exchange user service account with valid o365 E3 license getting disabled after every 3-4 weeks
Office Exchange user service account with valid o365 E3 license getting disabled and we are getting following error after every 3-4 weeks:

Error Message: An internal server error occurred. The operation failed., Mailbox 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' doesn't have a valid license.

are we missing any configuration settings, etc.

this is happening with  valid o365 E3 license, when we create a new account it works as expected but after every 3-4 weeks getting this issue.


问:
I can't delete nor initialize selected cookies
Hi I'm trying to delete selected cookies drom the website I'm working on but for some reason they aren't deleted

That's what I tried to do:

```<code>var cookiesList = ["amp_c480ca","_gat","_gcl_au","_gid","_ga","_hjSessionUser_2101300"];
var path = "/";
var domain = ".pic-time.com";
var i = 0;
var name = cookiesList[i];

cookiesList.forEach(deleteSelectedCookie);

function deleteSelectedCookie() {
if(get_cookie(name) ) {
document.cookie = name + "=" +
    ((path) ? ";path="+path:"")+
    ((domain)?";domain="+domain:"") +
    ";expires=Thu, 01 Jan 1970 00:00:01 GMT";
}
name = cookiesList[i++];
}

function get_cookie(name){
    return document.cookie.split(';').some(c => {
        return c.trim().startsWith(name + '=');
    });
}
</code>```

But for some I reason it doesn't initialize/delete the cookies

Body:
Hi I'm trying to delete selected cookies drom the website I'm working on but for some reason they aren't deleted

That's what I tried to do:

var cookiesList = ["amp_c480ca","_gat","_gcl_au","_gid","_ga","_hjSessionUser_2101300"];
var path = "/";
var domain = ".pic-time.com";
var i = 0;
var name = cookiesList[i];

cookiesList.forEach(deleteSelectedCookie);

function deleteSelectedCookie() {
if(get_cookie(name) ) {
document.cookie = name + "=" +
    ((path) ? ";path="+path:"")+
    ((domain)?";domain="+domain:"") +
    ";expires=Thu, 01 Jan 1970 00:00:01 GMT";
}
name = cookiesList[i++];
}

function get_cookie(name){
    return document.cookie.split(';').some(c => {
        return c.trim().startsWith(name + '=');
    });
}

But for some I reason it doesn't initialize/delete the cookies


问:
Bash script decrease/increase numbers
i want a shell script which takes as arguments a set of numbers and the array and sorts them in ascending or descending order.Also i should make the appropriate checks to ensure that the arguments given will be numbers (after 1st argument).
output:

```<code>./script1.sh incr 4 5 6 0
0
4
5
6

./script2.sh dec 4 5 6 0

6
5
4
0
</code>```

My try:

```<code>#!/bin/bash
k="$1"

shift

declare -i x

x=($#)

if [ $x == 0 ]
then
        echo "give dec or incr and numbers"
        exit 1
fi

arr=($*)

if [ $k == "dec" ]
then
        for i in ${arr[@]}
        do
                echo $i
        done > file1sorted
        sort -nr file1sorted
        rm file1sorted
fi

if [ $k == "incr" ]
then
        for i in ${arr[@]}
        do
                echo $i
        done > file1sorted
        sort -n file1sorted
        rm file1sorted
fi

</code>```

It runs well but checking if parameters are numbers doesn't work.

my output:

```<code>   324
   231
   2
   1
   a

</code>```

I want it to give me an error if I put something that is not a number

Title: Bash script decrease/increase numbers

Body:
i want a shell script which takes as arguments a set of numbers and the array and sorts them in ascending or descending order.Also i should make the appropriate checks to ensure that the arguments given will be numbers (after 1st argument).
output:

./script1.sh incr 4 5 6 0
0
4
5
6

./script2.sh dec 4 5 6 0

6
5
4
0

My try:

#!/bin/bash
k="$1"

shift

declare -i x

x=($#)

if [ $x == 0 ]
then
        echo "give dec or incr and numbers"
        exit 1
fi

arr=($*)

if [ $k == "dec" ]
then
        for i in ${arr[@]}
        do
                echo $i
        done > file1sorted
        sort -nr file1sorted
        rm file1sorted
fi

if [ $k == "incr" ]
then
        for i in ${arr[@]}
        do
                echo $i
        done > file1sorted
        sort -n file1sorted
        rm file1sorted
fi

It runs well but checking if parameters are numbers doesn't work.

my output:

   324
   231
   2
   1
   a

I want it to give me an error if I put something that is not a number


问:
How to use a custom PostgreSQL type in SeaORM?
I have the following table in postgres

create table retailers(id: integer, name: citext);
```
<p><code>citext</code> is just case insensitive text in PostgreSQL.
How do I modify the Entity creation in SeaORM to support that?</p>
<p>When I generate entities in SeaORM in rust, I get the following error:</p>
```error: Missing macro attribute, either `string_value` or `num_value` should be specified or specify repr[X] and have a value for every entry
  --> src/entity/sea_orm_active_enums.rs:10:5
```

How do I create new types in SeaORM in Rust?

Body:
I have the following table in postgres

create table retailers(id: integer, name: citext);

citext is just case insensitive text in PostgreSQL.
How do I modify the Entity creation in SeaORM to support that?

When I generate entities in SeaORM in rust, I get the following error:

error: Missing macro attribute, either `string_value` or `num_value` should be specified or specify repr[X] and have a value for every entry
  --> src/entity/sea_orm_active_enums.rs:10:5

How do I create new types in SeaORM in Rust?


问:
Change number format in Excel using names of headers - openpyxl
I have an Excel with many columns. I want to loop through headers that contain the partial string "Date" such that all headers that contain the word "Date" are formatted as date. I struggle with mainly 2 points:

I need to refer to the column by its letter.

I know how to change the format to date for one column, but not for multiple columns based on a shared string.

```<code>import openpyxl

wb = openpyxl.load_workbook(r'C:\filepath\filename.xlsx')
ws = wb['Sheet1']

for row in range(2, ws.max_row+1):
    ws["{}{}".format("D", row)].number_format='yyyy-mm-dd;@'

wb.save(r'C:\filepath\filename.xlsx')
</code>```

As you can see, I now refer to the column by the letter D, but would like to do this with its header name, if possible. I know of the function .get_column_letter but I don't know how to combine this with the fact that I'd like to use the partial strings.

Thanks for your help in advance.

Body:
I have an Excel with many columns. I want to loop through headers that contain the partial string "Date" such that all headers that contain the word "Date" are formatted as date. I struggle with mainly 2 points:

I need to refer to the column by its letter.

I know how to change the format to date for one column, but not for multiple columns based on a shared string.

import openpyxl

wb = openpyxl.load_workbook(r'C:\filepath\filename.xlsx')
ws = wb['Sheet1']

for row in range(2, ws.max_row+1):
    ws["{}{}".format("D", row)].number_format='yyyy-mm-dd;@'

wb.save(r'C:\filepath\filename.xlsx')

As you can see, I now refer to the column by the letter D, but would like to do this with its header name, if possible. I know of the function .get_column_letter but I don't know how to combine this with the fact that I'd like to use the partial strings.

Thanks for your help in advance.


问:
Accessing Object Property Using Unknown String in Typescript
I have an object declared as

```<code>const allowedUpdates = {
    'title': 'val1',
    'categories': 'val2',
    'preview': 'val3'
}
</code>```

I then try to access the data in the following function:

```<code>for (const [updateKey, updateValue] of Object.entries(projectUpdates)) {
    const correspondingValue = allowedUpdates?.[userSubmittedString];
};
</code>```

The userSubmittedString variable is a string with unknown value (although ideally it would match one of the keys in the allowedUpdates object - but it's not guaranteed).

TypeScript gives me an error saying:

Element implicitly has an 'any' type because expression of type
'string' can't be used to index type '{ title: string; categories:
string; preview: string; }'.

No index signature with a parameter of
type 'string' was found on type '{ title: string; categories: string;
preview: string; }'.

The only workaround I found that works is to pretend that the user will only ever submit compatible values via <keyof typeof allowedUpdates> type assignment to userSubmittedString, but I'd prefer not to do that because it doesn't resemble the real world, where a user can submit any string they like. There are other validations performed down the line to handle such situations.

Is there a more graceful way of getting rid of the error?

Body:
I have an object declared as

const allowedUpdates = {
    'title': 'val1',
    'categories': 'val2',
    'preview': 'val3'
}

I then try to access the data in the following function:

for (const [updateKey, updateValue] of Object.entries(projectUpdates)) {
    const correspondingValue = allowedUpdates?.[userSubmittedString];
};

The userSubmittedString variable is a string with unknown value (although ideally it would match one of the keys in the allowedUpdates object - but it's not guaranteed).

TypeScript gives me an error saying:

Element implicitly has an 'any' type because expression of type
'string' can't be used to index type '{ title: string; categories:
string; preview: string; }'.

No index signature with a parameter of
type 'string' was found on type '{ title: string; categories: string;
preview: string; }'.

The only workaround I found that works is to pretend that the user will only ever submit compatible values via <keyof typeof allowedUpdates> type assignment to userSubmittedString, but I'd prefer not to do that because it doesn't resemble the real world, where a user can submit any string they like. There are other validations performed down the line to handle such situations.

Is there a more graceful way of getting rid of the error?


问:
How can we expand the lightning component to full screen
I have the requirement to expand the lightning component on whole screen.
I tried the css but that's not worked. But None of them working
.maincontent{
height: 100%;
background-color: deepskyblue;
}</p>
```<code>html, body { height: 100%; }
body { background-color: deepskyblue; }

Please suggest the way to achieve it.

Current Page:-

[![Current][1]][1]

Expectation :-
[![Expectation][2]][2]

  [1]: https://i.stack.imgur.com/iuI6K.png
  [2]: https://i.stack.imgur.com/qLZhs.png
</code>```

Body:
I have the requirement to expand the lightning component on whole screen.
I tried the css but that's not worked. But None of them working
.maincontent{
height: 100%;
background-color: deepskyblue;
}

html, body { height: 100%; }
body { background-color: deepskyblue; }

Please suggest the way to achieve it.

Current Page:-

[![Current][1]][1]

Expectation :-
[![Expectation][2]][2]

  [1]: https://i.stack.imgur.com/iuI6K.png
  [2]: https://i.stack.imgur.com/qLZhs.png


问:
SwiftUI select only XX first value in array with ForEach
In my project I've got a view where I use a ForEach to load each line of my structured array. This array is filled via a Firebase download when the app is started but to be more responsive I would like to load only some last value. I've got a date value in each line and I would like for example the only 10 first lines where the first line is the most recent entry !
The number of last entry to show is saved via the @AppStorage in the user setting part of the app.
And I'm trying to implement a button "load more line" at the end of all my array lines.

My view is defined as follow :

```<code>    //get the numbers of flights to load in my array or 10 by default
@AppStorage("flightToLoad") private var flightToLoad: Int = 10
@State var thisSessionFlightToLoad = flightToLoad
[...var body ...]
ScrollView{
    VStack {
        //First ForEach to set the Date value as Section Header :
        ForEach(flightLibrary.uniqueDates, id: \.self) { date in
            Section(header:
                        HStack{
                Text(flightLibrary.frmt.string(from: date))
                    .font(.title3)
                Spacer()
            }
            ) {
                //Second ForEach to show all the value of each line in my array
                ForEach(flightLibrary.testFlight.filter({Calendar.current.isDate($0.date, inSameDayAs: date)})) { flight in
                    if flight <= thisSessionFlightToLoad{
                        ZStack {
                            RoundedRectangle(cornerRadius: 10, style: .continuous)
                                .fill(Color.white)
                            NavigationLink(
                                destination: {
                                    // Code for destination view
                                }, label: {
                                    LogbookCellView2(flight: flight)
                                }).accentColor(.black)
                        }
                    }else{
                        // Here I try to add a Button after the line allready loaded
                        Button{
                            thisSessionFlightToLoad = thisSessionFlightToLoad + 10
                        }label:{
                            Text("Load more flights")
                        }
                    }
                }
            }
        }
    }.padding(.horizontal, 8)
}
</code>```

But this is totally not working ...

Hope to be clear in my question !

Thanks for your help !

Body:
In my project I've got a view where I use a ForEach to load each line of my structured array. This array is filled via a Firebase download when the app is started but to be more responsive I would like to load only some last value. I've got a date value in each line and I would like for example the only 10 first lines where the first line is the most recent entry !
The number of last entry to show is saved via the @AppStorage in the user setting part of the app.
And I'm trying to implement a button "load more line" at the end of all my array lines.

My view is defined as follow :

    //get the numbers of flights to load in my array or 10 by default
@AppStorage("flightToLoad") private var flightToLoad: Int = 10
@State var thisSessionFlightToLoad = flightToLoad
[...var body ...]
ScrollView{
    VStack {
        //First ForEach to set the Date value as Section Header :
        ForEach(flightLibrary.uniqueDates, id: \.self) { date in
            Section(header:
                        HStack{
                Text(flightLibrary.frmt.string(from: date))
                    .font(.title3)
                Spacer()
            }
            ) {
                //Second ForEach to show all the value of each line in my array
                ForEach(flightLibrary.testFlight.filter({Calendar.current.isDate($0.date, inSameDayAs: date)})) { flight in
                    if flight <= thisSessionFlightToLoad{
                        ZStack {
                            RoundedRectangle(cornerRadius: 10, style: .continuous)
                                .fill(Color.white)
                            NavigationLink(
                                destination: {
                                    // Code for destination view
                                }, label: {
                                    LogbookCellView2(flight: flight)
                                }).accentColor(.black)
                        }
                    }else{
                        // Here I try to add a Button after the line allready loaded
                        Button{
                            thisSessionFlightToLoad = thisSessionFlightToLoad + 10
                        }label:{
                            Text("Load more flights")
                        }
                    }
                }
            }
        }
    }.padding(.horizontal, 8)
}

But this is totally not working ...

Hope to be clear in my question !

Thanks for your help !


问:
Wrapping html to other half of the page on page break and handling headings after the page break
I've got a table with very few columns but many rows on an html document. I'm trying to save paper during printing and I'm wondering if there is a way to wrap the table to the other half of the page.

It needs to keep the headings of the table on the other half as well like it does during a page break.

Another issue that comes up is that there are nested headers that need to repeat as well. For example:
Heading 1 Company A
Heading 1.1 Branch A
Some Data
Heading 1.2 Branch B
Some Data
Heading 2 Company B
Heading 2.1 Branch C
Some Data
Heading 2.2 Branch D
Some Data

That means that if there is still data for either of the sub heading they also need to be repeated after the page break.

I'm also trying to use base html so I can't use any libaries.

So far I have tried using the normal html table and using flex box form of a table


问:
The class "Process" of .net is freezing the program after start it
I have a program that start other programs in .net. It works well but some times they start a program and the program start but not run.
None actions is made by the programa and the process and memory consumy is zero.
This happens usualy when i start the second program inside a service, but it occours when i use a windows form program either.
Below is the function that I use to start a program:

`

```<code>   protected int ExecutarPrograma()
        {

            //não há o que executar!
            if (Programa == "")
                return 0;
            using (Process prg = new Process())
            {
                Programa = Programa.Trim();
                string prgName;
                string args;
                int index = Programa.IndexOf(' ');
                if (index == -1)
                {
                    prgName = Programa;
                    args = "";
                }
                else
                {
                    prgName = Programa.Substring(0, index);
                    args = Programa.Substring(index + 1);
                }

                prg.StartInfo.FileName = TVariavel.parse(prgName);
                prg.StartInfo.WorkingDirectory = Diretorio;
                prg.StartInfo.Arguments = TVariavel.parse(args);
                logar("Processo " + nome + " Executando: (" + prg.StartInfo.FileName + " " + prg.StartInfo.Arguments + ")");
                if (usarShell)
                {
                    prg.StartInfo.UseShellExecute = false;
                    if (!System.IO.File.Exists(prg.StartInfo.FileName))
                    {
                        if (Diretorio.EndsWith(@"\"))
                            prg.StartInfo.FileName = Diretorio + prg.StartInfo.FileName;
                        else
                            prg.StartInfo.FileName = Diretorio + @"\" + prg.StartInfo.FileName;
                    }
                }

                prg.Start();
                DateTime timeout = DateTime.Now;
                timeout = timeout.AddMinutes(Tempo);
                do
                {
                    if (prg.HasExited)
                    {
                        logar("Processo " + nome + " Executado ok saida:" + prg.ExitCode.ToString());
                        return 0;
                    }
                    //se deu timeout
                    if (tempo != 0 && timeout < DateTime.Now)
                    {
                        LastErro = 1;
                        msgErro = "Timeout na execução do programa";
                        logar("Processo " + nome + " " + msgErro);
                        prg.Kill();
                        return LastErro;
                    }
                    Thread.Sleep(100);
                } while (true);
            }
        }
</code>```

`

I try with and without the "SetApartmentState" in the thread and with "UseShellExecute" with true and false.

Body:
I have a program that start other programs in .net. It works well but some times they start a program and the program start but not run.
None actions is made by the programa and the process and memory consumy is zero.
This happens usualy when i start the second program inside a service, but it occours when i use a windows form program either.
Below is the function that I use to start a program:

`

   protected int ExecutarPrograma()
        {

            //não há o que executar!
            if (Programa == "")
                return 0;
            using (Process prg = new Process())
            {
                Programa = Programa.Trim();
                string prgName;
                string args;
                int index = Programa.IndexOf(' ');
                if (index == -1)
                {
                    prgName = Programa;
                    args = "";
                }
                else
                {
                    prgName = Programa.Substring(0, index);
                    args = Programa.Substring(index + 1);
                }

                prg.StartInfo.FileName = TVariavel.parse(prgName);
                prg.StartInfo.WorkingDirectory = Diretorio;
                prg.StartInfo.Arguments = TVariavel.parse(args);
                logar("Processo " + nome + " Executando: (" + prg.StartInfo.FileName + " " + prg.StartInfo.Arguments + ")");
                if (usarShell)
                {
                    prg.StartInfo.UseShellExecute = false;
                    if (!System.IO.File.Exists(prg.StartInfo.FileName))
                    {
                        if (Diretorio.EndsWith(@"\"))
                            prg.StartInfo.FileName = Diretorio + prg.StartInfo.FileName;
                        else
                            prg.StartInfo.FileName = Diretorio + @"\" + prg.StartInfo.FileName;
                    }
                }

                prg.Start();
                DateTime timeout = DateTime.Now;
                timeout = timeout.AddMinutes(Tempo);
                do
                {
                    if (prg.HasExited)
                    {
                        logar("Processo " + nome + " Executado ok saida:" + prg.ExitCode.ToString());
                        return 0;
                    }
                    //se deu timeout
                    if (tempo != 0 && timeout < DateTime.Now)
                    {
                        LastErro = 1;
                        msgErro = "Timeout na execução do programa";
                        logar("Processo " + nome + " " + msgErro);
                        prg.Kill();
                        return LastErro;
                    }
                    Thread.Sleep(100);
                } while (true);
            }
        }

`

I try with and without the "SetApartmentState" in the thread and with "UseShellExecute" with true and false.


问:
App crashing on sending a optional value while presenting a view in SwiftUI
Please refer below code,

```<code>struct ContentView: View {
    @State var value: String?
    @State var isPresented = false

    let notification = NotificationCenter.default.publisher(for: Notification.Name(rawValue: "post")).receive(on: RunLoop.main)

    var body: some View {
        NavigationStack {
            VStack(spacing: 10) {
                Button {
                    NotificationCenter.default.post(name: Notification.Name(rawValue: "post"), object: nil, userInfo: ["value": "Jeeva"])
                    debugPrint("Post triggered")
                    self.isPresented.toggle()
                } label: {
                    Text("Post")
                }
                .buttonStyle(.borderedProminent)
            }
        }
        .padding()
        .fullScreenCover(isPresented: $isPresented) {
            Text(value!)
        }
        .onReceive(notification) { output in
            guard let out = output.userInfo else {
                debugPrint("no output")
                return
            }
            self.value = out["value"] as? String
        }
    }
}
</code>```

I'm trying to open a view consists of a String value

By default, value is an optional String, I'll get the value in a notification and assigning that value to the variable value using onReceive modifier.

After assigning the value, I'm toggling theisPresent variable, which will trigger the fullScreenCover

Once the fullScreenCover triggered, app is getting crashed!

Can anyone help me? Thanks in advance

Body:
Please refer below code,

struct ContentView: View {
    @State var value: String?
    @State var isPresented = false

    let notification = NotificationCenter.default.publisher(for: Notification.Name(rawValue: "post")).receive(on: RunLoop.main)

    var body: some View {
        NavigationStack {
            VStack(spacing: 10) {
                Button {
                    NotificationCenter.default.post(name: Notification.Name(rawValue: "post"), object: nil, userInfo: ["value": "Jeeva"])
                    debugPrint("Post triggered")
                    self.isPresented.toggle()
                } label: {
                    Text("Post")
                }
                .buttonStyle(.borderedProminent)
            }
        }
        .padding()
        .fullScreenCover(isPresented: $isPresented) {
            Text(value!)
        }
        .onReceive(notification) { output in
            guard let out = output.userInfo else {
                debugPrint("no output")
                return
            }
            self.value = out["value"] as? String
        }
    }
}

I'm trying to open a view consists of a String value

By default, value is an optional String, I'll get the value in a notification and assigning that value to the variable value using onReceive modifier.

After assigning the value, I'm toggling theisPresent variable, which will trigger the fullScreenCover

Once the fullScreenCover triggered, app is getting crashed!

Can anyone help me? Thanks in advance


问:
Keep attached screen session alive and waiting for more commands to enter from detached screens
I had this idea of a script that I was trying to make come to light. I want one main process that is running and keeping track of subprocesses running in the background. I decided to go with screen for my implementation, and I can run the main.sh in attached mode, with the subcommands all running in detached. I can also send text to the main.sh once each sub-process has hit their point. However, i want the main script to be running until all sub-processes finish (accomplished), but I want it to be updating what it is printing out to the user. I currently have the main process doing:

```<code>while screen -list | grep -q process-1 || screen -list | grep -q process-2 || screen -list | grep -q process-3; do
  sleep 1
done
</code>```

which works perfectly as the main loop, but any data i send to that process just prints out like text, not like a command. Is there a way I can keep a screen session alive and receiving more commands/variables?

I currently plan on sending data from the sub-process like screen -S main -X stuff "PROCESS_1=FINISHED" and the main will keep trying to grab the variable PROCESS_1 to get it's status.

I can't just get the result of the sub-process either, as for at least one of the commands i plan on it running continuously, but I want to let the main-process know when it has hit a certain point. I was also tinkering with the idea of using file descriptors but I had issues getting that working in detached mode.

Is this possible and I haven't just used/found the right command? Do i need to somehow use another screen as a like a data layer so that the main layer just prints out to the user?

For completeness, here is the current setup:

start.sh

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

screen -S process-1 -dm ./process-1.sh
screen -S process-2 -dm ./process-2.sh
screen -S main -m ./main.sh
</code>```

main.sh

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

while screen -list | grep -q process-1 || screen -list | grep -q process-2; do
  sleep 1
done
</code>```

process-1.sh

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

count=0
while [[ count -ne 5 ]]; do
  ((count+=1))
  sleep 5
done

screen -S main -X stuff "PROCESS_1=FINISHED"
</code>```

process-2.sh

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

count=0
while [[ count -ne 3 ]]; do
  ((count+=1))
  sleep 5
done

screen -S main -X stuff "PROCESS_2=FINISHED"
</code>```

Thanks for any advice you can provide.

EDIT:
Something along these lines is the end goal, like Vue.js, a constant screen that updates whenever changes are made (or in this case processes end)

Body:
I had this idea of a script that I was trying to make come to light. I want one main process that is running and keeping track of subprocesses running in the background. I decided to go with screen for my implementation, and I can run the main.sh in attached mode, with the subcommands all running in detached. I can also send text to the main.sh once each sub-process has hit their point. However, i want the main script to be running until all sub-processes finish (accomplished), but I want it to be updating what it is printing out to the user. I currently have the main process doing:

while screen -list | grep -q process-1 || screen -list | grep -q process-2 || screen -list | grep -q process-3; do
  sleep 1
done

which works perfectly as the main loop, but any data i send to that process just prints out like text, not like a command. Is there a way I can keep a screen session alive and receiving more commands/variables?

I currently plan on sending data from the sub-process like screen -S main -X stuff "PROCESS_1=FINISHED" and the main will keep trying to grab the variable PROCESS_1 to get it's status.

I can't just get the result of the sub-process either, as for at least one of the commands i plan on it running continuously, but I want to let the main-process know when it has hit a certain point. I was also tinkering with the idea of using file descriptors but I had issues getting that working in detached mode.

Is this possible and I haven't just used/found the right command? Do i need to somehow use another screen as a like a data layer so that the main layer just prints out to the user?

For completeness, here is the current setup:

start.sh

#!/bin/bash

screen -S process-1 -dm ./process-1.sh
screen -S process-2 -dm ./process-2.sh
screen -S main -m ./main.sh

main.sh

#!/bin/bash

while screen -list | grep -q process-1 || screen -list | grep -q process-2; do
  sleep 1
done

process-1.sh

#!/bin/bash

count=0
while [[ count -ne 5 ]]; do
  ((count+=1))
  sleep 5
done

screen -S main -X stuff "PROCESS_1=FINISHED"

process-2.sh

#!/bin/bash

count=0
while [[ count -ne 3 ]]; do
  ((count+=1))
  sleep 5
done

screen -S main -X stuff "PROCESS_2=FINISHED"

Thanks for any advice you can provide.

EDIT:
Something along these lines is the end goal, like Vue.js, a constant screen that updates whenever changes are made (or in this case processes end)


问:
How to get first elements from a pyspark array?
I have an array and I just keep a specific column from it like this in PySpark:

c = [ "green", "blue", "red", "yellow",... ]

And I want to keep the n first elements of this column
How can I do this please ? I know is a simple question but I don't find the solution ...

Thanks


问:
Sending TRX with tronpy
I'm using tronpy library to send trx, here is my code:

```<code>from tronpy import Tron
from tronpy.keys import PrivateKey

# integers representing half & one Tron
HALF_TRON = 500000
ONE_TRON = 1000000 #equals 1 TRX

# your wallet information
WALLET_ADDRESS = "TTJSsmQWypFyH6LzjJ83G8JHedKKhrnWXK" #MY WALLET
PRIVATE_KEY = "private key here"
priv_key = PrivateKey(bytes.fromhex("0ec032178bdfb76c6a4a4f9a1fea661d1ef74322a102bd4f3180e6d7ed4a3f43"))
client = Tron()

def send_tron(amount, wallet):
    try:

        # create transaction and broadcast it
        txn = (
            client.trx.transfer(WALLET_ADDRESS, str(wallet), int(amount))
            .memo("Transaction Description")
            .build()
            .inspect()
            .sign(priv_key)
            .broadcast()
        )

        return txn.wait()

    # return the exception
    except Exception as ex:
        return ex

send_tron(1000000, 'THLFjoyxxrBnKd7UtfGzruhMZfJb2xY87С')
</code>```

When I'm running this code, nothing happens. I've checked both wallets, private key and my balance, everyting is fine.I've tried:
client = Tron(network='nile')

Title: Sending TRX with tronpy

Body:
I'm using tronpy library to send trx, here is my code:

from tronpy import Tron
from tronpy.keys import PrivateKey

# integers representing half & one Tron
HALF_TRON = 500000
ONE_TRON = 1000000 #equals 1 TRX

# your wallet information
WALLET_ADDRESS = "TTJSsmQWypFyH6LzjJ83G8JHedKKhrnWXK" #MY WALLET
PRIVATE_KEY = "private key here"
priv_key = PrivateKey(bytes.fromhex("0ec032178bdfb76c6a4a4f9a1fea661d1ef74322a102bd4f3180e6d7ed4a3f43"))
client = Tron()

def send_tron(amount, wallet):
    try:

        # create transaction and broadcast it
        txn = (
            client.trx.transfer(WALLET_ADDRESS, str(wallet), int(amount))
            .memo("Transaction Description")
            .build()
            .inspect()
            .sign(priv_key)
            .broadcast()
        )

        return txn.wait()

    # return the exception
    except Exception as ex:
        return ex

send_tron(1000000, 'THLFjoyxxrBnKd7UtfGzruhMZfJb2xY87С')

When I'm running this code, nothing happens. I've checked both wallets, private key and my balance, everyting is fine.I've tried:
client = Tron(network='nile')


问:
Flutter - How to prioritize child's gestures detection over parent's scroll gestures?
I'm building a cross platform Flutter app (Web, iOS, Android) in which the main feed is a horizontal PageView.

Navigation on this pageview is only possible by pan gestures.

Some of the children of this PageView need to be able to receive horizontal gestures => the problem is that FLutter gives priority to the PageView's scroll instead of the child's pan gestures.

Here is a sample that reproduces my issue (touchscreen needed) : In the following, you cannot change the width of the nested black54 container with a horizontal gesture.

```<code>class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  double containerWidth = 100;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("test"),
      ),
      body: Center(
        child: PageView(
          physics: BouncingScrollPhysics(),
          children: [
            Container(height: 500, width: 600, color: Colors.green),
            Container(
              height: 500,
              width: 600,
              color: Colors.blue,
              child: Center(
                  child: GestureDetector(
                      onPanUpdate: (details) {
                        setState(() {
                          containerWidth += details.delta.dx;
                        });
                      },
                      child: Container(
                          width: containerWidth,
                          height: 50,
                          color: Colors.black54))),
            ),
            Container(height: 500, width: 600, color: Colors.red),
          ],
        ),
      ),
    );
  }
}
</code>```

What I tried :

I tried nesting the view inside a gesturedetector with onHorizontalDragUpdate: (e) {},
=> it prevents the child from receiving gestures.

I tried adding
behavior: HitTestBehavior.deferToChild or HitTestBehavior.translucent
=> Still nothing.

The only working method is to disable scrolling physics when the PageController arrives on the second page. But this is not exactly what I want as I still want the user to be able to scroll on the zone around the child gesturedetector.

Body:
I'm building a cross platform Flutter app (Web, iOS, Android) in which the main feed is a horizontal PageView.

Navigation on this pageview is only possible by pan gestures.

Some of the children of this PageView need to be able to receive horizontal gestures => the problem is that FLutter gives priority to the PageView's scroll instead of the child's pan gestures.

Here is a sample that reproduces my issue (touchscreen needed) : In the following, you cannot change the width of the nested black54 container with a horizontal gesture.

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  double containerWidth = 100;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("test"),
      ),
      body: Center(
        child: PageView(
          physics: BouncingScrollPhysics(),
          children: [
            Container(height: 500, width: 600, color: Colors.green),
            Container(
              height: 500,
              width: 600,
              color: Colors.blue,
              child: Center(
                  child: GestureDetector(
                      onPanUpdate: (details) {
                        setState(() {
                          containerWidth += details.delta.dx;
                        });
                      },
                      child: Container(
                          width: containerWidth,
                          height: 50,
                          color: Colors.black54))),
            ),
            Container(height: 500, width: 600, color: Colors.red),
          ],
        ),
      ),
    );
  }
}

What I tried :

I tried nesting the view inside a gesturedetector with onHorizontalDragUpdate: (e) {},
=> it prevents the child from receiving gestures.

I tried adding
behavior: HitTestBehavior.deferToChild or HitTestBehavior.translucent
=> Still nothing.

The only working method is to disable scrolling physics when the PageController arrives on the second page. But this is not exactly what I want as I still want the user to be able to scroll on the zone around the child gesturedetector.


问:
Is it possible to do the whole training procedure in GPU with Tensorflow/Keras?
If the dataset is small enough to fit in the GPU memory, is it possible with Tensorflow to allocate it all initially and then do the training without having data transfers between CPU and GPU?
It seems to me that with tf.data this is not possible and the data transfer is not controlled by the programmer.

Analyzing the GPU workload during training, it reaches 75% with CIFAR10, but I would expect it to reach 100% being that the dataset fit in GPU memory.Also analyzing with Tensorboard I see that there are a lot of Send operations.
(I saw that there is a similar question quite old here, however at that time there was no tf.data yet)


问:
RecyclerView in scrollview cut last items
I have fragment with 2 RecyclerView.
I get some data from api and add it for RecyclerViews in ArrayLists, then notify view that data was changed. For some reason, the last element(s) of the RecyclerViews is getting cut-off. When i get 8 object - RVs show only 5 of them. On small screens even less. I am disable RVs scrolling, and want use one ScrollView for all fragment content.

This is the XML of the fragment:s

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".screens.view.MainFragment">

    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/onDutyMainRefreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingHorizontal="@dimen/margin_m"
                android:paddingVertical="@dimen/margin_m">

                <TextView
                    android:id="@+id/requestTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    android:fontFamily="@font/sfprotext_semibold"
                    android:textStyle="bold"
                    android:textSize="@dimen/on_duty_main_subtitle_font_size"
                    android:textColor="@color/dark_liver"
                    android:text="Requests"
                    tools:text="Requests"/>

                <Button
                    android:id="@+id/showAllRequestsButton"
                    style="@style/ShowAllButtonDark"
                    app:layout_constraintBottom_toBottomOf="@+id/requestTitle"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/requestTitle"
                    tools:ignore="TouchTargetSizeCheck"
                    android:text="Show All"
                    tools:text="Show All" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/requestsRecyclerView"
                    android:layout_width="match_parent"
                    android:layout_marginTop="@dimen/on_duty_recycler_view_margin_top"
                    android:layout_height="wrap_content"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/requestTitle" />

                <TextView
                    android:id="@+id/groupTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/sfprotext_semibold"
                    android:textColor="@color/dark_liver"
                    android:textSize="@dimen/on_duty_main_subtitle_font_size"
                    android:textStyle="bold"
                    android:layout_marginTop="@dimen/margin_m"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/requestsRecyclerView"
                    android:text="Groups"
                    tools:text="Groups" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/groupsRecyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/on_duty_recycler_view_margin_top"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/groupTitle" />

            </androidx.constraintlayout.widget.ConstraintLayout>
        </ScrollView>

    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

I try found solution in other question like that, but nothing helped me.
For examle, i tryed some solution from RecyclerView is cutting off the last item

Body:
I have fragment with 2 RecyclerView.
I get some data from api and add it for RecyclerViews in ArrayLists, then notify view that data was changed. For some reason, the last element(s) of the RecyclerViews is getting cut-off. When i get 8 object - RVs show only 5 of them. On small screens even less. I am disable RVs scrolling, and want use one ScrollView for all fragment content.

This is the XML of the fragment:s

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".screens.view.MainFragment">

    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/onDutyMainRefreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingHorizontal="@dimen/margin_m"
                android:paddingVertical="@dimen/margin_m">

                <TextView
                    android:id="@+id/requestTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    android:fontFamily="@font/sfprotext_semibold"
                    android:textStyle="bold"
                    android:textSize="@dimen/on_duty_main_subtitle_font_size"
                    android:textColor="@color/dark_liver"
                    android:text="Requests"
                    tools:text="Requests"/>

                <Button
                    android:id="@+id/showAllRequestsButton"
                    style="@style/ShowAllButtonDark"
                    app:layout_constraintBottom_toBottomOf="@+id/requestTitle"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/requestTitle"
                    tools:ignore="TouchTargetSizeCheck"
                    android:text="Show All"
                    tools:text="Show All" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/requestsRecyclerView"
                    android:layout_width="match_parent"
                    android:layout_marginTop="@dimen/on_duty_recycler_view_margin_top"
                    android:layout_height="wrap_content"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/requestTitle" />

                <TextView
                    android:id="@+id/groupTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/sfprotext_semibold"
                    android:textColor="@color/dark_liver"
                    android:textSize="@dimen/on_duty_main_subtitle_font_size"
                    android:textStyle="bold"
                    android:layout_marginTop="@dimen/margin_m"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/requestsRecyclerView"
                    android:text="Groups"
                    tools:text="Groups" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/groupsRecyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/on_duty_recycler_view_margin_top"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/groupTitle" />

            </androidx.constraintlayout.widget.ConstraintLayout>
        </ScrollView>

    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

I try found solution in other question like that, but nothing helped me.
For examle, i tryed some solution from RecyclerView is cutting off the last item


问:
How to force upper case for an entire column in MUI 5 Material UI DataGrid?
What I am specting to set a style to an specific column with the attribute textTransform:uppercase.

For header I'm already using headerClassName to target the style of an specific header

Thanks in advance for any help. Have a great week


问:
Get password from sqlite3 database
I have problems when i try to retrieve the password that match the username which has been typed in(username is socket.username). i can get the hashedpassword, but when i try to console.log(getpassword) it just returns: SELECT password FROM users WHERE username = "hej123" as a string. I want to get the password that match the typed in username from the database, and when they login it should check both passwords are same.
Sql query shall take the password from the database
Please help:)</p>
```<code>socket.on('existing user', function (username, password) {
    // we store the username in the socket session for this client
    socket.username = validator.escape(username);
    socket.password = validator.escape(password);

    const salt = 'Some salt for the hash';

   // Hash the salt and password with 1000 iterations, 64 length and sha512 digest
   const hashedPassword = crypto.pbkdf2Sync(socket.password, salt, 1000, 64, 'sha512').toString('hex');

    db.serialize(function() {

      // console.log('checking if user exists');
      var getPassword = `SELECT password FROM users WHERE username = "${socket.username}"`
      db.get(getPassword, function() {
        console.log(hashedPassword)

        if (getPassword === hashedPassword) {
          console.log("virker")
        }
          else(console.log("ik godt"))

      })
</code>```

Title: Get password from sqlite3 database

Body:
I have problems when i try to retrieve the password that match the username which has been typed in(username is socket.username). i can get the hashedpassword, but when i try to console.log(getpassword) it just returns: SELECT password FROM users WHERE username = "hej123" as a string. I want to get the password that match the typed in username from the database, and when they login it should check both passwords are same.
Sql query shall take the password from the database
Please help:)

socket.on('existing user', function (username, password) {
    // we store the username in the socket session for this client
    socket.username = validator.escape(username);
    socket.password = validator.escape(password);

    const salt = 'Some salt for the hash';

   // Hash the salt and password with 1000 iterations, 64 length and sha512 digest
   const hashedPassword = crypto.pbkdf2Sync(socket.password, salt, 1000, 64, 'sha512').toString('hex');

    db.serialize(function() {

      // console.log('checking if user exists');
      var getPassword = `SELECT password FROM users WHERE username = "${socket.username}"`
      db.get(getPassword, function() {
        console.log(hashedPassword)

        if (getPassword === hashedPassword) {
          console.log("virker")
        }
          else(console.log("ik godt"))

      })


问:
Not getting node metrics for mysqld_exporter and postgres_exporter for RDS instances
I have setup a system for RDS monitoring and used mysqld_exporter and postgres_exporter and exposed their metrics to prometheus server but I am not getting important metrics to monitor like CPU_Utilization, memory available, iops rate, latency etc. I am getting about 1800 metrics but none of them are these I suppose. I think i need node exporter for RDS monitoring for getting cpu utilization but i don't know how to configure node_exporter for RDS instance.
PS: I don't want to use AWS Cloudwatch metrics</p>


问:
How to set up a suctom dataset to train on whisper
How can I set tup a dataset to train on whisper model with custom data, I have transcripctions on excel file and audios in another folder, all the examples call a dataset from huggingFace</p>