问:
How can TickerProvider vsync property be used inside ConsumerWidget/Stateless widget Riverpod | Flutter
The timer package I'm using made some breaking changes which are very helpful performance wise but this clashes with my design of ConsumerWidgets.

So I'm wondering if there is a way to get this working without changing everything.
This post gives a clue passing Scaffold.of() which I can't see working in my situation, seems weird to pass context around.

How can I get this working within my current design or with some preferably simple changes?

Form Widget:

```<code>class OTPSignInForm extends ConsumerWidget {
  OTPSignInForm({Key? key}) : super(key: key);
  final GlobalKey<FormState> _otpSignInFormKey = GlobalKey<FormState>();
  final GlobalKey<FormState> _localSignInFormKey = GlobalKey<FormState>();

  final CustomTimerController _emailOTPTimeController = CustomTimerController(
    vsync: Scaffold.of(context),                                 // Takes TickerProvider
    begin: const Duration(minutes: 10),
    end: const Duration(minutes: 0),
    initialState: CustomTimerState.reset,
    interval: CustomTimerInterval.seconds,
  );

  final CustomTimerController _phoneOTPTimeController = CustomTimerController(
    vsync: Scaffold.of(context),                                // Takes TickerProvider
    begin: const Duration(minutes: 10),
    end: const Duration(minutes: 0),
    initialState: CustomTimerState.reset,
    interval: CustomTimerInterval.seconds,
  );

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return Column(
      children: [
        AutofillGroup(
          child: Form(
            key: _localSignInFormKey,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [

                       ...

                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      TextContent.of(context).otpVerifyCodeExpiryWarning,
                      style: ThemeEndpoints.secondaryHeader(),
                    ),
                    const SizedBox(width: 8.0),
                    OTPTimer(timeController: _emailOTPTimeController),    // Passing here
                  ],
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      TextContent.of(context).otpVerifyCodeExpiryWarning,
                      style: ThemeEndpoints.secondaryHeader(),
                    ),
                    const SizedBox(width: 8.0),
                    OTPTimer(timeController: _phoneOTPTimeController),    // Passing here
                  ],

                ),
              ],
            ),
          ),
                ...
        ),
      ],
    );
  }
</code>```

Timer:

```<code>class OTPTimer extends StatelessWidget {
  final CustomTimerController timeController;

  const OTPTimer({
    required this.timeController,
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CustomTimer(
      controller: timeController,
      builder: (state, time) {
        return Text(
          "${time.hours}:${time.minutes}:${time.seconds}",
          style: timerStyle(time),
        );
      },
    );
  }

  // // Timer time text
  TextStyle timerStyle(CustomTimerRemainingTime timeRemaining) {
    // Green indicator text
    if (int.parse(timeRemaining.minutesWithoutFill) > 3) {
      return ThemeEndpoints.infoHeaderPositive();
    }
    // Yellow indicator warning text
    if (int.parse(timeRemaining.minutesWithoutFill) < 3 &&
        int.parse(timeRemaining.minutesWithoutFill) > 1) {
      return ThemeEndpoints.infoHeaderWarning();
    }
    // Red indicator warning text
    return ThemeEndpoints.infoHeaderNegative();
  }
}
</code>```

Body:
The timer package I'm using made some breaking changes which are very helpful performance wise but this clashes with my design of ConsumerWidgets.

So I'm wondering if there is a way to get this working without changing everything.
This post gives a clue passing Scaffold.of() which I can't see working in my situation, seems weird to pass context around.

How can I get this working within my current design or with some preferably simple changes?

Form Widget:

class OTPSignInForm extends ConsumerWidget {
  OTPSignInForm({Key? key}) : super(key: key);
  final GlobalKey<FormState> _otpSignInFormKey = GlobalKey<FormState>();
  final GlobalKey<FormState> _localSignInFormKey = GlobalKey<FormState>();

  final CustomTimerController _emailOTPTimeController = CustomTimerController(
    vsync: Scaffold.of(context),                                 // Takes TickerProvider
    begin: const Duration(minutes: 10),
    end: const Duration(minutes: 0),
    initialState: CustomTimerState.reset,
    interval: CustomTimerInterval.seconds,
  );

  final CustomTimerController _phoneOTPTimeController = CustomTimerController(
    vsync: Scaffold.of(context),                                // Takes TickerProvider
    begin: const Duration(minutes: 10),
    end: const Duration(minutes: 0),
    initialState: CustomTimerState.reset,
    interval: CustomTimerInterval.seconds,
  );

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return Column(
      children: [
        AutofillGroup(
          child: Form(
            key: _localSignInFormKey,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [

                       ...

                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      TextContent.of(context).otpVerifyCodeExpiryWarning,
                      style: ThemeEndpoints.secondaryHeader(),
                    ),
                    const SizedBox(width: 8.0),
                    OTPTimer(timeController: _emailOTPTimeController),    // Passing here
                  ],
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      TextContent.of(context).otpVerifyCodeExpiryWarning,
                      style: ThemeEndpoints.secondaryHeader(),
                    ),
                    const SizedBox(width: 8.0),
                    OTPTimer(timeController: _phoneOTPTimeController),    // Passing here
                  ],

                ),
              ],
            ),
          ),
                ...
        ),
      ],
    );
  }

Timer:

class OTPTimer extends StatelessWidget {
  final CustomTimerController timeController;

  const OTPTimer({
    required this.timeController,
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CustomTimer(
      controller: timeController,
      builder: (state, time) {
        return Text(
          "${time.hours}:${time.minutes}:${time.seconds}",
          style: timerStyle(time),
        );
      },
    );
  }

  // // Timer time text
  TextStyle timerStyle(CustomTimerRemainingTime timeRemaining) {
    // Green indicator text
    if (int.parse(timeRemaining.minutesWithoutFill) > 3) {
      return ThemeEndpoints.infoHeaderPositive();
    }
    // Yellow indicator warning text
    if (int.parse(timeRemaining.minutesWithoutFill) < 3 &&
        int.parse(timeRemaining.minutesWithoutFill) > 1) {
      return ThemeEndpoints.infoHeaderWarning();
    }
    // Red indicator warning text
    return ThemeEndpoints.infoHeaderNegative();
  }
}


来源: stackexchange

问:
Custom type replacement with Hot Chocolate 12
My schema defines an Employee type that has 15 or so fields on it. It's then used multiple times in other areas:

```<code>type Employee {
  active: Boolean!
  name: String
  id: Int!
  ...
}

type Room {
  owner: Employee!
  delegate: Employee
}
</code>```

99% of the time, I want the same three fields when returning data on an employee. So I end up writing a query like this:

```<code>query {
  rooms {
    owner: {
      name
      id
      active
    }
  }
}
</code>```

which is repetative when something has multiple employees. Is there a way to define some type of transformation so that instead I'd do something like:

```<code>query {
  rooms {
    owner: @commEmpFields
  }
}
</code>```

My initial thought was to create a custom ObjectType<Employee> but then I realized that I didn't know how to map that to the query.

ContentLicense: CC BY-SA 4.0

Body:
My schema defines an Employee type that has 15 or so fields on it. It's then used multiple times in other areas:

type Employee {
  active: Boolean!
  name: String
  id: Int!
  ...
}

type Room {
  owner: Employee!
  delegate: Employee
}

99% of the time, I want the same three fields when returning data on an employee. So I end up writing a query like this:

query {
  rooms {
    owner: {
      name
      id
      active
    }
  }
}

which is repetative when something has multiple employees. Is there a way to define some type of transformation so that instead I'd do something like:

query {
  rooms {
    owner: @commEmpFields
  }
}

My initial thought was to create a custom ObjectType<Employee> but then I realized that I didn't know how to map that to the query.


问:
Do not allow INSERT in table during execution of stored procedure
During the execution of a particular stored procedure (i.e, while it is running), I do not want to allow any INSERT into a given table in the database, queue it, and then insert it after the procedure execution is complete. How can I do this in SQL Server?

Edit: the procedure does not insert anything, it calculates some metrics, whose size changes if new data is inserted during the execution. Hence, I want to prevent insertion during the execution of the stored procedure.


问:
How to get docker containers on separate hosts to share a volume?
Docker n00b here. I have conatinerized programs running on two different physical computers. on '200', I have node-red, deepstack, mosquito, etc. on '199', I have iSpy (NVR) plus a couple others. I have installed docker swarm, and I am using portainer as a front end. Portainer renders the manager and worker just fine and it seems the swarm is working. Here's the problem I cant figure out:

I need Node-red (on '200') to read a file that is saved on '199', then pass it through deepstack and do a bunch of other things, but I cant for the life of me figure out how to get node-red to read from the other physical machine. I figure if I can get some kind of persistent volume that is shared between all the different containers, I should be good, but when I create a container, it can only be seen by the host its on (not the other one). In other words, I can create a voilume on '200' and have node-red and deepstack see the same files, but ispy (on '199') doesnt even have the option of mounting that same volume.

So....what am I missing. I KNOW there is an easy solution, but I cant seem to find it.

Any help would be appreciatted.

I have tried to connect them using a single internal net5work (through Docker Swarm), but Node-red doesnt seem to want to see the other machine when I use the internal ip for it.

I tried to create a persistent volume and attach it to the several docker containers, but it seems the volumes can only be connected to the containers that are on the same host

I tried to bind to folders outside of docker and then samba share them across the home network, but node-red wouldnt see that folder when using the ip address of the smb share.


问:
Typescript compiler including type imports for each type I export
Im using a the khan-academy/flow-to-ts script to generate TS files for my project, from there im trying to generate an index.d.ts file to include in my project. I'm confused by the results:

My script:

```<code>const glob = require('glob');
const jsc = require('jscodeshift');
const flowParser = require('jscodeshift/parser/flow');
const fs = require('fs');
const convert = require('@khanacademy/flow-to-ts/dist/convert.bundle.js');
const ts = require('typescript');

const files = glob.sync('./packages/myFlowApp/src/**/*.js');
const TYPESCRIPT_DIRECTORY = './packages/gestalt/typescript';

// Create TS files
files.forEach((file) => {
  const flowCode = fs.readFileSync(file, 'utf-8');

  const ast = jsc(flowCode, {
    parser: flowParser(),
  });

  const transformedCode = ast.toSource();

  const typescriptCode = convert.convert(transformedCode);

  fs.writeFileSync(`${TYPESCRIPT_DIRECTORY}/${FILE_NAME}`, typescriptCode);
});

// Get TS Files
const tsFiles = glob.sync(`${TYPESCRIPT_DIRECTORY}/**/*.ts`);

const tsOptions = {
  outFile: `${TYPESCRIPT_DIRECTORY}/index`,
};

// Create index.d.ts
const program = ts.createProgram(tsFiles, tsOptions);
const res = program.emit();
</code>```

tsconfig.js:

```<code>{
  "compilerOptions": {
    "declarationDir": "typescript/",
    "lib": ["DOM", "DOM.Iterable", "ES2020"],

    "module": "commonjs",
    "target": "es6",
    "moduleResolution": "node",

    "allowSyntheticDefaultImports": true,
    "strict": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noUncheckedIndexedAccess": true,
    "strictNullChecks": true,
    "jsx": "react",
    "declaration": true,
    "emitDeclarationOnly": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "baseUrl": "."
  },
  "include": ["./scripts/typescript/**/*"],
  "exclude": []
}
</code>```

The issue im seeing is that the resulting index.d.ts includes all these imports for each exported type and im confused why that is or if that's expected? I assume it has to do with my tsconfig.js file but not sure how to fix it or if there is anything to fix?

Example result:

```<code>/// <reference types="react" />
declare module 'myFlowApp' {
    export interface Box {
      import type { Node, AbstractComponent, Element } from 'react';
      import type { Indexable } from 'zIndex';
      import 'zIndex';
      import 'boxTypes';

      type Column = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
      type Dimension = number | string;
      type Direction = 'row' | 'column';
      type Display = 'none' | 'flex' | 'block' | 'inlineBlock' |

      const BoxWithForwardRef: AbstractComponent<Props, HTMLElement>;
      export default BoxWithForwardRef;
  }

  export interface Icon {
    import { $Keys } from 'utility-types';
    import type { Node } from 'react';
    import 'react';
    import icons from './icons/index';

    export type IconColor =
      | 'default'
      | 'subtle'
      | 'success'
      | 'error'
      | 'warning'
      | 'info'
      | 'recommendation'
      | 'inverse'
      | 'shopping'
      | 'brandPrimary'
      | 'light'
      | 'dark';

    type Props = {

      accessibilityLabel: string;

      color?: IconColor;

      icon?: $Keys<typeof icons>;

      dangerouslySetSvgPath?: {
        __path: string;
      };
      size?: number | string;
    };

    declare function Icon({
      accessibilityLabel,
      color,
      dangerouslySetSvgPath,
      icon,
      inline,
      size,
    }: Props): Node;
    declare namespace Icon {
      var icons: readonly $Keys<any>[];
    }
    export default Icon;
  }
}
</code>```

Im new to typescript don't know if this is expected, it seems redundant to have to import type Node for each of these types

Body:
Im using a the khan-academy/flow-to-ts script to generate TS files for my project, from there im trying to generate an index.d.ts file to include in my project. I'm confused by the results:

My script:

const glob = require('glob');
const jsc = require('jscodeshift');
const flowParser = require('jscodeshift/parser/flow');
const fs = require('fs');
const convert = require('@khanacademy/flow-to-ts/dist/convert.bundle.js');
const ts = require('typescript');

const files = glob.sync('./packages/myFlowApp/src/**/*.js');
const TYPESCRIPT_DIRECTORY = './packages/gestalt/typescript';

// Create TS files
files.forEach((file) => {
  const flowCode = fs.readFileSync(file, 'utf-8');

  const ast = jsc(flowCode, {
    parser: flowParser(),
  });

  const transformedCode = ast.toSource();

  const typescriptCode = convert.convert(transformedCode);

  fs.writeFileSync(`${TYPESCRIPT_DIRECTORY}/${FILE_NAME}`, typescriptCode);
});

// Get TS Files
const tsFiles = glob.sync(`${TYPESCRIPT_DIRECTORY}/**/*.ts`);

const tsOptions = {
  outFile: `${TYPESCRIPT_DIRECTORY}/index`,
};

// Create index.d.ts
const program = ts.createProgram(tsFiles, tsOptions);
const res = program.emit();

tsconfig.js:

{
  "compilerOptions": {
    "declarationDir": "typescript/",
    "lib": ["DOM", "DOM.Iterable", "ES2020"],

    "module": "commonjs",
    "target": "es6",
    "moduleResolution": "node",

    "allowSyntheticDefaultImports": true,
    "strict": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noUncheckedIndexedAccess": true,
    "strictNullChecks": true,
    "jsx": "react",
    "declaration": true,
    "emitDeclarationOnly": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "baseUrl": "."
  },
  "include": ["./scripts/typescript/**/*"],
  "exclude": []
}

The issue im seeing is that the resulting index.d.ts includes all these imports for each exported type and im confused why that is or if that's expected? I assume it has to do with my tsconfig.js file but not sure how to fix it or if there is anything to fix?

Example result:

/// <reference types="react" />
declare module 'myFlowApp' {
    export interface Box {
      import type { Node, AbstractComponent, Element } from 'react';
      import type { Indexable } from 'zIndex';
      import 'zIndex';
      import 'boxTypes';

      type Column = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
      type Dimension = number | string;
      type Direction = 'row' | 'column';
      type Display = 'none' | 'flex' | 'block' | 'inlineBlock' |

      const BoxWithForwardRef: AbstractComponent<Props, HTMLElement>;
      export default BoxWithForwardRef;
  }

  export interface Icon {
    import { $Keys } from 'utility-types';
    import type { Node } from 'react';
    import 'react';
    import icons from './icons/index';

    export type IconColor =
      | 'default'
      | 'subtle'
      | 'success'
      | 'error'
      | 'warning'
      | 'info'
      | 'recommendation'
      | 'inverse'
      | 'shopping'
      | 'brandPrimary'
      | 'light'
      | 'dark';

    type Props = {

      accessibilityLabel: string;

      color?: IconColor;

      icon?: $Keys<typeof icons>;

      dangerouslySetSvgPath?: {
        __path: string;
      };
      size?: number | string;
    };

    declare function Icon({
      accessibilityLabel,
      color,
      dangerouslySetSvgPath,
      icon,
      inline,
      size,
    }: Props): Node;
    declare namespace Icon {
      var icons: readonly $Keys<any>[];
    }
    export default Icon;
  }
}

Im new to typescript don't know if this is expected, it seems redundant to have to import type Node for each of these types


问:
Deserialise multiple objects into a select statment
In a table, I store multiple string records in several records.

```<code>declare @x nvarchar(max) = {
  "totalSize": 1000,
  "done": true,
  "records": [
    {
      "attributes": {
        "type": "Contract",
        "url": ""
      },
      "Name": "Harpy",
      "Job_Schedule_Date__c": null,
      "EndDate": "2021-03-24",
      "Account": {
        "attributes": {
          "type": "Account",
          "url": ""
        },
        "Name": "Madison"
      },
      "ContractNumber": "12345",

      "Related_Site__r": {
        "attributes": {
          "type": "Site__c",
          "url": ""
        },
        "Name": "Jackson"
      }
    },
    .
    .
    .
  ]
}

select * from openJson(@x, '$.records')
</code>```

I am trying to use open JSON to unpack the records.

I am able to unpack a single record, but it doesn't unpack them into columns and need to unpack multiple records and join them.

Since each record only stores 1000 records, I need to join them up.

What I want is output like below as a Select

```<code>Name, Job_Schedule_Date__c, EndDate, AccountName, ContractNumber, RelatedSiteName
Harpy, null, 2021-03-24, Madison, 12345, Jackson
</code>```

Body:
In a table, I store multiple string records in several records.

declare @x nvarchar(max) = {
  "totalSize": 1000,
  "done": true,
  "records": [
    {
      "attributes": {
        "type": "Contract",
        "url": ""
      },
      "Name": "Harpy",
      "Job_Schedule_Date__c": null,
      "EndDate": "2021-03-24",
      "Account": {
        "attributes": {
          "type": "Account",
          "url": ""
        },
        "Name": "Madison"
      },
      "ContractNumber": "12345",

      "Related_Site__r": {
        "attributes": {
          "type": "Site__c",
          "url": ""
        },
        "Name": "Jackson"
      }
    },
    .
    .
    .
  ]
}

select * from openJson(@x, '$.records')

I am trying to use open JSON to unpack the records.

I am able to unpack a single record, but it doesn't unpack them into columns and need to unpack multiple records and join them.

Since each record only stores 1000 records, I need to join them up.

What I want is output like below as a Select

Name, Job_Schedule_Date__c, EndDate, AccountName, ContractNumber, RelatedSiteName
Harpy, null, 2021-03-24, Madison, 12345, Jackson


问:
Allowing CTRL + c functionality in C++ wrapper program
I am writing a wrapper program in C++ for Linux, which calls several other binaries in sequence by use of the system() function.

While testing, I noticed that if I enter Ctrl + C in the terminal during execution of one of the child processes invoked by system(), only that child process gets halted. In other words, that subprocess stops, but the wrapper program is unaffected, and continues the subsequent binary calls.

This results in me having to continue inputting Ctrl + C on all children until the C++ binary runs to completion. I would like to allow my user to halt the entire wrapper program with Ctrl + C.

After researching other similar questions, it seems clear that one must leverage process groups on Linux to properly distribute the halt signal. However, I am unsure of how to relay a stop signal from a child process called by system() to the parent wrapper.


问:
Missing PDO Driver for SQLite
I created a droplet in DigitalOcean (LAMP on Ubuntu 20.04)
Installed WP PHP files using WinSCP
Run it on PUTTY
Checked site on web browser

I received a message saying "PDO Driver for SQLite is missing"

Found solutions online and here's what I've tried:

Find php.ini & uncomment (remove ;) on extension=pdo_mysql & extension=pdo_sqlite

Restarted apache on PuTTY by using this command sudo service apache2 restart

But didn't work

Any tips please?

Title: Missing PDO Driver for SQLite


问:
AxiosError: Request failed with status code 404 | Unhandled Promised in Infinity Loop - REACT NATIVE
I was wondering if anybody could help me with this...

I'm calling an api using axios. And I need to set the data response in a state. And then, I'd use that state inside of a component.
I'm pretty much grabbing html text, and throwing it inside of a webview.

However, i've been facing :

```<code>WARN  Possible Unhandled Promise Rejection (id: 0):
[AxiosError: Request failed with status code 404]
</code>```

I know I can get rid of the WARN with a .catch().. I've done it. And all I'm left with is the 404.

While I see those things on my terminal. On my app, I get all the html looping through the same View. Kinda like stacking one on top of the other... And because I'm using .map(), I was expecting that each html would be display on their correspondent View. (that's because I'm using the id to grab them) I've also tried using .forEach()... but same thing happens..

Here's where I'm getting this:

```<code>if (myArray) {
  myArray.map( async (news) => {
    const { data } = await getMyNewsApi(news.id);
    setState(data);
  })
} else {
  setState('');
}
</code>```

Here's the component I'm mounting it on:

```<code>myArray ?
myArray.map((news) => {
return (
    <NoticiasCard
      key={news.id}
      title={news.title}
      urlLink={news.url}
      thumbnail={news.thumbnail}
      post={myState} // <== HERE IS WHERE IT'S GOING
    />
  )
}) : <></>
</code>```

Then, I go to that component.. and show it on a webview.. like this:

```<code><WebView
 style={{marginBottom: 300, height: '100%'}}
 javaScriptEnabled={true}
 domStorageEnabled={true}
 source={{ html:  `

<!DOCTYPE html>
<html>
   <head>
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <style>
    h1   {color: ${theme.colors.primary};}
    p    {color: ${theme.colors.text};}
   </style>
   </head>
     <body>${post}</body>
</html>
  ` }}
/>
</code>```

Once I press the component to open the news I get on this infinity loop I mentioned above.

So, the way I see.. I've got two things to worry about.

1 - this infinity loop. How do I prevent that and/or what is causing it?
2 - how to display each news in their specific component.

I've read on StackOverflow that I can't setState inside of a map.. is that the reason? And if so.. how could I fix that? I've tried I few things... But none worked for me.

Body:
I was wondering if anybody could help me with this...

I'm calling an api using axios. And I need to set the data response in a state. And then, I'd use that state inside of a component.
I'm pretty much grabbing html text, and throwing it inside of a webview.

However, i've been facing :

WARN  Possible Unhandled Promise Rejection (id: 0):
[AxiosError: Request failed with status code 404]

I know I can get rid of the WARN with a .catch().. I've done it. And all I'm left with is the 404.

While I see those things on my terminal. On my app, I get all the html looping through the same View. Kinda like stacking one on top of the other... And because I'm using .map(), I was expecting that each html would be display on their correspondent View. (that's because I'm using the id to grab them) I've also tried using .forEach()... but same thing happens..

Here's where I'm getting this:

if (myArray) {
  myArray.map( async (news) => {
    const { data } = await getMyNewsApi(news.id);
    setState(data);
  })
} else {
  setState('');
}

Here's the component I'm mounting it on:

myArray ?
myArray.map((news) => {
return (
    <NoticiasCard
      key={news.id}
      title={news.title}
      urlLink={news.url}
      thumbnail={news.thumbnail}
      post={myState} // <== HERE IS WHERE IT'S GOING
    />
  )
}) : <></>

Then, I go to that component.. and show it on a webview.. like this:

<WebView
 style={{marginBottom: 300, height: '100%'}}
 javaScriptEnabled={true}
 domStorageEnabled={true}
 source={{ html:  `

<!DOCTYPE html>

   <meta name="viewport" content="width=device-width, initial-scale=1.0">

     ${post}

  ` }}
/>

Once I press the component to open the news I get on this infinity loop I mentioned above.

So, the way I see.. I've got two things to worry about.

1 - this infinity loop. How do I prevent that and/or what is causing it?
2 - how to display each news in their specific component.

I've read on StackOverflow that I can't setState inside of a map.. is that the reason? And if so.. how could I fix that? I've tried I few things... But none worked for me.


问:
QProcess inside QtConcurrent::mapped - no slots called
The following code works - "echo" program is called for "abc" and "def",
the results are collected and printed.

If timer delay is set to 0, it stops working.

"echo" is called, even the readLine (if called) would return the right content,
but "finished" slot is never called. process.state() shows that the process is still running.

Why?

```<code>QFuture<QString> tfuture;
QFutureWatcher<QString> twatcher;

QString ftest(QString a){
    QProcess process;
    QEventLoop loop;
    QObject::connect(&process, &QProcess::finished, [&](int exit_code) {
        qDebug() << "OK " << a << " " << exit_code;
        loop.exit(0);
    });
    QTimer::singleShot(1, [&] {
        qDebug() << "STARTING " << a;
        process.start("echo", {{"ECHO ", a}});
    });
    loop.exec();
    return process.readLine();
};

void tfinished() {
    QList<QString> result = twatcher.future().results();
    qDebug() << "finished " << result;
}

...
QStringList params = {{"abc", "def"}};
tfuture = QtConcurrent::mapped(params, ftest);
connect(&twatcher, &QFutureWatcher<QString>::finished, this, &tfinished);
twatcher.setFuture(tfuture);
</code>```

Body:
The following code works - "echo" program is called for "abc" and "def",
the results are collected and printed.

If timer delay is set to 0, it stops working.

"echo" is called, even the readLine (if called) would return the right content,
but "finished" slot is never called. process.state() shows that the process is still running.

Why?

QFuture<QString> tfuture;
QFutureWatcher<QString> twatcher;

QString ftest(QString a){
    QProcess process;
    QEventLoop loop;
    QObject::connect(&process, &QProcess::finished, [&](int exit_code) {
        qDebug() << "OK " << a << " " << exit_code;
        loop.exit(0);
    });
    QTimer::singleShot(1, [&] {
        qDebug() << "STARTING " << a;
        process.start("echo", {{"ECHO ", a}});
    });
    loop.exec();
    return process.readLine();
};

void tfinished() {
    QList<QString> result = twatcher.future().results();
    qDebug() << "finished " << result;
}

...
QStringList params = {{"abc", "def"}};
tfuture = QtConcurrent::mapped(params, ftest);
connect(&twatcher, &QFutureWatcher<QString>::finished, this, &tfinished);
twatcher.setFuture(tfuture);


问:
???-PHP/SQL--How to cycle through a column in a SQL table and pass it as a variable
I apologize in advance.  This is probably really easy but I'm self-taught so I only learned the things I needed to use at the time.

I'm trying to pull the TITLE field in the CATEGORIES table as a variable and cycle through it to access info from the CUSTOMERS table.

Currently, I'm doing this for every category (e.g., Cabins and Counseling)

```<code>        <?php
        $query = "SELECT * FROM customers WHERE page LIKE '%lockhart_texas_cabins%' ORDER BY location, name";
        ?>

        <?php
        $query = "SELECT * FROM customers WHERE page LIKE '%lockhart_texas_counseling%' ORDER BY location, name";
        ?>
</code>```

I want to make it dynamic so it searches for Bed and Breakfast Inns, displays the info from the CUSTOMERS table, then repeats for Boat, Tube & Jet Ski Rentals, on so on.

I think I need to do a WHILE loop outside the above code but not sure what it should look like.

Any help would be appreciated.

Body:
I apologize in advance.  This is probably really easy but I'm self-taught so I only learned the things I needed to use at the time.

I'm trying to pull the TITLE field in the CATEGORIES table as a variable and cycle through it to access info from the CUSTOMERS table.

Currently, I'm doing this for every category (e.g., Cabins and Counseling)

        <?php
        $query = "SELECT * FROM customers WHERE page LIKE '%lockhart_texas_cabins%' ORDER BY location, name";
        ?>

        <?php
        $query = "SELECT * FROM customers WHERE page LIKE '%lockhart_texas_counseling%' ORDER BY location, name";
        ?>

I want to make it dynamic so it searches for Bed and Breakfast Inns, displays the info from the CUSTOMERS table, then repeats for Boat, Tube & Jet Ski Rentals, on so on.

I think I need to do a WHILE loop outside the above code but not sure what it should look like.

Any help would be appreciated.


问:
Whats the best way to parse/expand a REST API results with arrays
I have a result from a REST API call, that has a property which is a  JSON array.

What would be the best way to select a specific property out of that field.

The field looks like this:

values         : @{isForceAuth=false; tokenId=e3e944ee-059b-41c0-a7db-7969090e0722;successAuthMethods=identityProvider.embedded.authMethod.certificate; success=true;              destination=https://test.test.com/SAAS/API/1.0/GET/apps/launch/app/d22dd6b6a-4ac38b44686c1ec5f128appLaunchId=_b0f991454edfgfdgb6b0af2eb;authMethods=identityProvider.embedded.authMethod.certificate;actorExternalId=43f7d22f-84e4-46c2-83d9-1dhghfdfgce}

I've been trying to add it to an array with minimal success


问:
How to match products to their description using a composite primary key in products collection
I am struggling to match products in a products collection with the product info collections where the products has a composite primary key in the products collection.  The product are assigned a description code which they can use to extract the description for the products. However, I cannot successfully get a match using the composite id. My goal is to generate two reports. The first report should generate the products with their descriptions. The second should generate a reports for products with no descriptions. i have included my attempt to match the products with no description inspired from a solution kindly provided by rickhg12hs. However, my attempt does not work with composite keys.

Here are the collections:

     //products
      {
        "_id" : {
          "productId" : NumberLong(23300),
          "categoryId" : NumberLong(7777)
        },
         "name" : "Musk Spray",
         "quantity" : 12333,
         "category" : "Fragrance",
         "price" : 122.99,
         "descriptionCode" : NumberLong(75),
         "brand" : "Musk Cologne",
         "updatedDate" : ISODate("2023-01-03T20:46:45.099+0000"),
         "createdDate" : ISODate("2023-01-03T20:46:45.099+0000"),
       }

      //product-info
      {
         "_id" : ObjectId("572179b333316ab012),
         "productId": NumberLong(23300),
         "categoryId": NumberLong(7777),
         "descriptionCode" : NumberLong(75),
         "description" : 12333,
         "price" : 122.99,
         "description" : "Medium Range Cologne For Men",

        }

```
<p>My attempt to find products without a description:</p>
<pre class="lang-json prettyprint-override"><code>
           db.products.aggregate([
            {
               "$lookup": {
                  "from": "product-info",
                  "let": {
                   "productId": "$_id.productId",
                   "categoryId": "$_id.categoryId"
                  },
                  "as": "productInfo",
                  "pipeline": [
                   { // look for matches in productInfo
                    "$match": {
                    "$expr": {
                        "$and": [
                        {"$eq": ["$productId", "$$productId"]},
                        {"$eq": ["$categoryId", "$$categoryId"]}
                        ]
                      }
                    }
                 },
                 { // if matched, no need to return everything
                    "$project": {
                    "_id": 1
                    }
                }
                 ]
                }
             },
             { // match when no productInfo found
               "$match": {
                  "$expr": {
                  "$eq": [{"$size": "$productInfo"}, 0]
                  }
                }
              },
              { // output requested fields
               "$project": {
                "_id": 0,
                "productId": 1,
                "categoryId": 1
               }
             }
          ])

</code>```

Body:
I am struggling to match products in a products collection with the product info collections where the products has a composite primary key in the products collection.  The product are assigned a description code which they can use to extract the description for the products. However, I cannot successfully get a match using the composite id. My goal is to generate two reports. The first report should generate the products with their descriptions. The second should generate a reports for products with no descriptions. i have included my attempt to match the products with no description inspired from a solution kindly provided by rickhg12hs. However, my attempt does not work with composite keys.

Here are the collections:

     //products
      {
        "_id" : {
          "productId" : NumberLong(23300),
          "categoryId" : NumberLong(7777)
        },
         "name" : "Musk Spray",
         "quantity" : 12333,
         "category" : "Fragrance",
         "price" : 122.99,
         "descriptionCode" : NumberLong(75),
         "brand" : "Musk Cologne",
         "updatedDate" : ISODate("2023-01-03T20:46:45.099+0000"),
         "createdDate" : ISODate("2023-01-03T20:46:45.099+0000"),
       }

      //product-info
      {
         "_id" : ObjectId("572179b333316ab012),
         "productId": NumberLong(23300),
         "categoryId": NumberLong(7777),
         "descriptionCode" : NumberLong(75),
         "description" : 12333,
         "price" : 122.99,
         "description" : "Medium Range Cologne For Men",

        }

My attempt to find products without a description:

           db.products.aggregate([
            {
               "$lookup": {
                  "from": "product-info",
                  "let": {
                   "productId": "$_id.productId",
                   "categoryId": "$_id.categoryId"
                  },
                  "as": "productInfo",
                  "pipeline": [
                   { // look for matches in productInfo
                    "$match": {
                    "$expr": {
                        "$and": [
                        {"$eq": ["$productId", "$$productId"]},
                        {"$eq": ["$categoryId", "$$categoryId"]}
                        ]
                      }
                    }
                 },
                 { // if matched, no need to return everything
                    "$project": {
                    "_id": 1
                    }
                }
                 ]
                }
             },
             { // match when no productInfo found
               "$match": {
                  "$expr": {
                  "$eq": [{"$size": "$productInfo"}, 0]
                  }
                }
              },
              { // output requested fields
               "$project": {
                "_id": 0,
                "productId": 1,
                "categoryId": 1
               }
             }
          ])


问:
Entity Framework throws NullReferenceException when there are too many attributes in a class hierarchy
When I run the code bellow I get a NullReferenceException at MySql.Data.EntityFramework.SelectStatement.AddColumn.

Edit:
I added the stack trace to the bottom of the post and will look into creating a bug report with MySql.Data.EntityFramework.
Thank you for the suggestions, but I know what a null reference exception is, and the issue is not that the lists are not initialized. The issue is that the code breaks depending on the number of attributes on my Entity classes.

Breaking Code

```<code>using System.Data.Entity;
using System.Linq;

namespace TestProject
{
    public class Program
    {
        static void Main()
        {
            using (var db = new TestDB())
            {
                var objects = db.Object1s.Include(obj1 => obj1.Object2s).AsNoTracking().ToList();
            }
        }
    }
}
</code>```

Class structure

The class structure is simple:

2  base classes, Object1 and Object2.

9 classes that directly inherit from Object2.

There is a many to many relationship between Object1 and Object2

```<code>using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;

namespace TestProject
{

    [Table("table1")]
    public class Object1
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public HashSet<Object2> Object2s { get; set; }
    }

    [Table("table2")]
    public abstract class Object2
    {
        public int ID { get; set; }
        public HashSet<Object1> Object1s { get; set; }
        public int? _0 { get; set; }
        public int? _1 { get; set; }
        public int? _2 { get; set; }
        public int? _3 { get; set; }
        public int? _4 { get; set; }
        public int? _5 { get; set; }
        public int? _6 { get; set; }
        public int? _7 { get; set; }
        public int? _8 { get; set; }
        public int? _9 { get; set; }
        public int? _10 { get; set; }
        public int? _11 { get; set; }
        public int? _12 { get; set; }
        public int? _13 { get; set; }
        public int? _14 { get; set; }
        public int? _15 { get; set; }
        public int? _16 { get; set; }
        public int? _17 { get; set; }
        public int? _18 { get; set; }
        public int? _19 { get; set; }
    }

    [Table("table21")]
    public class Object21 : Object2
    {
        public int? _20 { get; set; }
        public int? _21 { get; set; }
        public int? _22 { get; set; }
        public int? _23 { get; set; }
        public int? _24 { get; set; }
        public int? _25 { get; set; }
        public int? _26 { get; set; }
        public int? _27 { get; set; }
        public int? _28 { get; set; }
        public int? _29 { get; set; }
        public int? _30 { get; set; }
        public int? _31 { get; set; }
        public int? _32 { get; set; }
        public int? _33 { get; set; }
        public int? _34 { get; set; }
        public int? _35 { get; set; }
        public int? _36 { get; set; }
        public int? _37 { get; set; }
        public int? _38 { get; set; }
        public int? _39 { get; set; }
    }

    [Table("table22")]
    public class Object22 : Object2
    {
        public int? _40 { get; set; }
        public int? _41 { get; set; }
        public int? _42 { get; set; }
        public int? _43 { get; set; }
        public int? _44 { get; set; }
        public int? _45 { get; set; }
        public int? _46 { get; set; }
        public int? _47 { get; set; }
        public int? _48 { get; set; }
        public int? _49 { get; set; }
        public int? _50 { get; set; }
        public int? _51 { get; set; }
        public int? _52 { get; set; }
        public int? _53 { get; set; }
        public int? _54 { get; set; }
        public int? _55 { get; set; }
        public int? _56 { get; set; }
        public int? _57 { get; set; }
        public int? _58 { get; set; }
        public int? _59 { get; set; }
    }

    [Table("table23")]
    public class Object23 : Object2
    {
        public int? _60 { get; set; }
        public int? _61 { get; set; }
        public int? _62 { get; set; }
        public int? _63 { get; set; }
        public int? _64 { get; set; }
        public int? _65 { get; set; }
        public int? _66 { get; set; }
        public int? _67 { get; set; }
        public int? _68 { get; set; }
        public int? _69 { get; set; }
        public int? _70 { get; set; }
        public int? _71 { get; set; }
        public int? _72 { get; set; }
        public int? _73 { get; set; }
        public int? _74 { get; set; }
        public int? _75 { get; set; }
        public int? _76 { get; set; }
        public int? _77 { get; set; }
        public int? _78 { get; set; }
        public int? _79 { get; set; }
    }

    [Table("table24")]
    public class Object24 : Object2
    {
        public int? _80 { get; set; }
        public int? _81 { get; set; }
        public int? _82 { get; set; }
        public int? _83 { get; set; }
        public int? _84 { get; set; }
        public int? _85 { get; set; }
        public int? _86 { get; set; }
        public int? _87 { get; set; }
        public int? _88 { get; set; }
        public int? _89 { get; set; }
        public int? _90 { get; set; }
        public int? _91 { get; set; }
        public int? _92 { get; set; }
        public int? _93 { get; set; }
        public int? _94 { get; set; }
        public int? _95 { get; set; }
        public int? _96 { get; set; }
        public int? _97 { get; set; }
        public int? _98 { get; set; }
        public int? _99 { get; set; }
    }

    [Table("table25")]
    public class Object25 : Object2
    {
        public int? _100 { get; set; }
        public int? _101 { get; set; }
        public int? _102 { get; set; }
        public int? _103 { get; set; }
        public int? _104 { get; set; }
        public int? _105 { get; set; }
        public int? _106 { get; set; }
        public int? _107 { get; set; }
        public int? _108 { get; set; }
        public int? _109 { get; set; }
        public int? _110 { get; set; }
        public int? _111 { get; set; }
        public int? _112 { get; set; }
        public int? _113 { get; set; }
        public int? _114 { get; set; }
        public int? _115 { get; set; }
        public int? _116 { get; set; }
        public int? _117 { get; set; }
        public int? _118 { get; set; }
        public int? _119 { get; set; }
    }

    [Table("table26")]
    public class Object26 : Object2
    {
        public int? _120 { get; set; }
        public int? _121 { get; set; }
        public int? _122 { get; set; }
        public int? _123 { get; set; }
        public int? _124 { get; set; }
        public int? _125 { get; set; }
        public int? _126 { get; set; }
        public int? _127 { get; set; }
        public int? _128 { get; set; }
        public int? _129 { get; set; }
        public int? _130 { get; set; }
        public int? _131 { get; set; }
        public int? _132 { get; set; }
        public int? _133 { get; set; }
        public int? _134 { get; set; }
        public int? _135 { get; set; }
        public int? _136 { get; set; }
        public int? _137 { get; set; }
        public int? _138 { get; set; }
        public int? _139 { get; set; }
    }

    [Table("table27")]
    public class Object27 : Object2
    {
        public int? _140 { get; set; }
        public int? _141 { get; set; }
        public int? _142 { get; set; }
        public int? _143 { get; set; }
        public int? _144 { get; set; }
        public int? _145 { get; set; }
        public int? _146 { get; set; }
        public int? _147 { get; set; }
        public int? _148 { get; set; }
        public int? _149 { get; set; }
        public int? _150 { get; set; }
        public int? _151 { get; set; }
        public int? _152 { get; set; }
        public int? _153 { get; set; }
        public int? _154 { get; set; }
        public int? _155 { get; set; }
        public int? _156 { get; set; }
        public int? _157 { get; set; }
        public int? _158 { get; set; }
        public int? _159 { get; set; }
    }

    [Table("table28")]
    public class Object28 : Object2
    {
        public int? _160 { get; set; }
        public int? _161 { get; set; }
        public int? _162 { get; set; }
        public int? _163 { get; set; }
        public int? _164 { get; set; }
        public int? _165 { get; set; }
        public int? _166 { get; set; }
        public int? _167 { get; set; }
        public int? _168 { get; set; }
        public int? _169 { get; set; }
        public int? _170 { get; set; }
        public int? _171 { get; set; }
        public int? _172 { get; set; }
        public int? _173 { get; set; }
        public int? _174 { get; set; }
        public int? _175 { get; set; }
        public int? _176 { get; set; }
        public int? _177 { get; set; }
        public int? _178 { get; set; }
        public int? _179 { get; set; }
    }

    [Table("table29")]
    public class Object29 : Object2
    {
        public int? _180 { get; set; }

        // This line will cause the program to crash. Remove it and it will work fine.
        public int? _181 { get; set; }
}
</code>```

Database Context

```<code>using System.Data.Entity;

namespace TestProject
{
    public class TestDB : DbContext
    {
        public TestDB()
            : base("name=TESTDBNAME")
        {
        }

        public virtual DbSet<Object1> Object1s { get; set; }
        public virtual DbSet<Object2> Object2s { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<Object1>().HasMany<Object2>(obj1 => obj1.Object2s).WithMany(obj2 => obj2.Object1s).Map(m =>
            {
                m.MapLeftKey("Object1ID");
                m.MapRightKey("Object2ID");
                m.ToTable("table1_table2");
            });
        }
    }

}
</code>```

I have tried several things to try to fix the error.

I first tried to remove attributes from the classes to try to pinpoint where the issue is coming from. I expected there to be a mismatch between the C# and the MySQL tables, which I could fix. I found that there was no one type of attribute that was causing the error, rather it is the number of attributes that is making it break. 181 nullable ints seems to be the magic number. This number changes depending on the type of attributes.

I tried moving all of the the attributes onto one class (Object2). I expected this to cause the same error, however it did not. I was able to put more than 181 attributes on the class.

I tried having only two classes in the hierarchy Object2 and Object21 (Object21 inherits from Object2). I put more than 181 attributes on Object2 and ran the code. I was not sure what to expect at this point. The code ran fine.

My take away from all of this is that there is a combination of number of derived classes and member variables on those classes that causes an error in MySql.Data.EntityFramework. I'm at a loss at this point and would appreciate any advice or suggestions. Thanks!

About the system:

OS: macOS Monterey 12.5

.NET version: 4.5.2

Mono Version: 6.12.0.113

Database: MySQL 8.0.31

Entity Framework version: 6.4.4

Database Connector: MySql.Data.EntityFramework 8.0.31

Stack Trace

```<code>System.NullReferenceException: Object reference not set to an instance of an object
   at MySql.Data.EntityFramework.SelectStatement.AddColumn (MySql.Data.EntityFramework.ColumnFragment column, MySql.Data.EntityFramework.Scope scope) [0x00025] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.Visit (System.Data.Entity.Core.Common.CommandTrees.DbApplyExpression expression) [0x001b5] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.CommandTrees.DbApplyExpression.Accept[TResultType] (System.Data.Entity.Core.Common.CommandTrees.DbExpressionVisitor`1[TResultType] visitor) [0x0000c] in <068a3c4080104e51828ab210be168ae8>:0
   at MySql.Data.EntityFramework.SqlGenerator.VisitInputExpression (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.VisitInputExpressionEnsureSelect (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.Visit (System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression expression) [0x00022] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression.Accept[TResultType] (System.Data.Entity.Core.Common.CommandTrees.DbExpressionVisitor`1[TResultType] visitor) [0x0000c] in <068a3c4080104e51828ab210be168ae8>:0
   at MySql.Data.EntityFramework.SqlGenerator.VisitInputExpression (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.VisitInputExpressionEnsureSelect (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.Visit (System.Data.Entity.Core.Common.CommandTrees.DbSortExpression expression) [0x00022] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.CommandTrees.DbSortExpression.Accept[TResultType] (System.Data.Entity.Core.Common.CommandTrees.DbExpressionVisitor`1[TResultType] visitor) [0x0000c] in <068a3c4080104e51828ab210be168ae8>:0
   at MySql.Data.EntityFramework.SqlGenerator.VisitInputExpression (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.VisitInputExpressionEnsureSelect (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.Visit (System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression expression) [0x00022] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression.Accept[TResultType] (System.Data.Entity.Core.Common.CommandTrees.DbExpressionVisitor`1[TResultType] visitor) [0x0000c] in <068a3c4080104e51828ab210be168ae8>:0
   at MySql.Data.EntityFramework.SelectGenerator.GenerateSQL (System.Data.Entity.Core.Common.CommandTrees.DbCommandTree tree) [0x0001d] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.MySqlClient.MySqlProviderServices.CreateDbCommandDefinition (System.Data.Entity.Core.Common.DbProviderManifest providerManifest, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree) [0x0005e] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.DbProviderServices.CreateDbCommandDefinition (System.Data.Entity.Core.Common.DbProviderManifest providerManifest, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext) [0x00000] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition (System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext) [0x00034] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor (System.Data.Common.DbProviderFactory storeProviderFactory, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext, System.Data.Entity.Infrastructure.DependencyResolution.IDbDependencyResolver resolver, System.Data.Entity.Core.Query.ResultAssembly.BridgeDataReaderFactory bridgeDataReaderFactory, System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory columnMapFactory) [0x002a7] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.EntityClient.Internal.EntityProviderServices.CreateCommandDefinition (System.Data.Common.DbProviderFactory storeProviderFactory, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext, System.Data.Entity.Infrastructure.DependencyResolution.IDbDependencyResolver resolver) [0x00000] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.EntityClient.Internal.EntityProviderServices.CreateDbCommandDefinition (System.Data.Entity.Core.Common.DbProviderManifest providerManifest, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext) [0x00016] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition (System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext) [0x00034] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.CreateCommandDefinition (System.Data.Entity.Core.Objects.ObjectContext context, System.Data.Entity.Core.Common.CommandTrees.DbQueryCommandTree tree) [0x00042] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.Prepare (System.Data.Entity.Core.Objects.ObjectContext context, System.Data.Entity.Core.Common.CommandTrees.DbQueryCommandTree tree, System.Type elementType, System.Data.Entity.Core.Objects.MergeOption mergeOption, System.Boolean streaming, System.Data.Entity.Core.Objects.Span span, System.Collections.Generic.IEnumerable`1[T] compiledQueryParameters, System.Data.Entity.Core.Common.Utils.AliasGenerator aliasGenerator) [0x00042] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan (System.Nullable`1[T] forMergeOption) [0x00281] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectQuery`1+<>c__DisplayClass41_0[T].<GetResults>b__1 () [0x0000b] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T] (System.Func`1[TResult] func, System.Data.Entity.Infrastructure.IDbExecutionStrategy executionStrategy, System.Boolean startLocalTransaction, System.Boolean releaseConnectionOnSuccess) [0x00087] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectQuery`1+<>c__DisplayClass41_0[T].<GetResults>b__0 () [0x00046] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult] (System.Func`1[TResult] operation) [0x00000] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectQuery`1[T].GetResults (System.Nullable`1[T] forMergeOption) [0x00093] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectQuery`1[T].<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__31_0 () [0x00000] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Internal.LazyEnumerator`1[T].MoveNext () [0x00008] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Collections.Generic.List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable) [0x00059] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:1108
   at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00062] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:87
   at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0000e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:30
   at TestProject.Program.Main () [0x00008] in /Users/mikalahmed/Projects/TestProject/TestProject/Program.cs:12

Formatted by https://st.elmah.io
</code>```

Body:
When I run the code bellow I get a NullReferenceException at MySql.Data.EntityFramework.SelectStatement.AddColumn.

Edit:
I added the stack trace to the bottom of the post and will look into creating a bug report with MySql.Data.EntityFramework.
Thank you for the suggestions, but I know what a null reference exception is, and the issue is not that the lists are not initialized. The issue is that the code breaks depending on the number of attributes on my Entity classes.

Breaking Code

using System.Data.Entity;
using System.Linq;

namespace TestProject
{
    public class Program
    {
        static void Main()
        {
            using (var db = new TestDB())
            {
                var objects = db.Object1s.Include(obj1 => obj1.Object2s).AsNoTracking().ToList();
            }
        }
    }
}

Class structure

The class structure is simple:

2  base classes, Object1 and Object2.

9 classes that directly inherit from Object2.

There is a many to many relationship between Object1 and Object2

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;

namespace TestProject
{

    [Table("table1")]
    public class Object1
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public HashSet<Object2> Object2s { get; set; }
    }

    [Table("table2")]
    public abstract class Object2
    {
        public int ID { get; set; }
        public HashSet<Object1> Object1s { get; set; }
        public int? _0 { get; set; }
        public int? _1 { get; set; }
        public int? _2 { get; set; }
        public int? _3 { get; set; }
        public int? _4 { get; set; }
        public int? _5 { get; set; }
        public int? _6 { get; set; }
        public int? _7 { get; set; }
        public int? _8 { get; set; }
        public int? _9 { get; set; }
        public int? _10 { get; set; }
        public int? _11 { get; set; }
        public int? _12 { get; set; }
        public int? _13 { get; set; }
        public int? _14 { get; set; }
        public int? _15 { get; set; }
        public int? _16 { get; set; }
        public int? _17 { get; set; }
        public int? _18 { get; set; }
        public int? _19 { get; set; }
    }

    [Table("table21")]
    public class Object21 : Object2
    {
        public int? _20 { get; set; }
        public int? _21 { get; set; }
        public int? _22 { get; set; }
        public int? _23 { get; set; }
        public int? _24 { get; set; }
        public int? _25 { get; set; }
        public int? _26 { get; set; }
        public int? _27 { get; set; }
        public int? _28 { get; set; }
        public int? _29 { get; set; }
        public int? _30 { get; set; }
        public int? _31 { get; set; }
        public int? _32 { get; set; }
        public int? _33 { get; set; }
        public int? _34 { get; set; }
        public int? _35 { get; set; }
        public int? _36 { get; set; }
        public int? _37 { get; set; }
        public int? _38 { get; set; }
        public int? _39 { get; set; }
    }

    [Table("table22")]
    public class Object22 : Object2
    {
        public int? _40 { get; set; }
        public int? _41 { get; set; }
        public int? _42 { get; set; }
        public int? _43 { get; set; }
        public int? _44 { get; set; }
        public int? _45 { get; set; }
        public int? _46 { get; set; }
        public int? _47 { get; set; }
        public int? _48 { get; set; }
        public int? _49 { get; set; }
        public int? _50 { get; set; }
        public int? _51 { get; set; }
        public int? _52 { get; set; }
        public int? _53 { get; set; }
        public int? _54 { get; set; }
        public int? _55 { get; set; }
        public int? _56 { get; set; }
        public int? _57 { get; set; }
        public int? _58 { get; set; }
        public int? _59 { get; set; }
    }

    [Table("table23")]
    public class Object23 : Object2
    {
        public int? _60 { get; set; }
        public int? _61 { get; set; }
        public int? _62 { get; set; }
        public int? _63 { get; set; }
        public int? _64 { get; set; }
        public int? _65 { get; set; }
        public int? _66 { get; set; }
        public int? _67 { get; set; }
        public int? _68 { get; set; }
        public int? _69 { get; set; }
        public int? _70 { get; set; }
        public int? _71 { get; set; }
        public int? _72 { get; set; }
        public int? _73 { get; set; }
        public int? _74 { get; set; }
        public int? _75 { get; set; }
        public int? _76 { get; set; }
        public int? _77 { get; set; }
        public int? _78 { get; set; }
        public int? _79 { get; set; }
    }

    [Table("table24")]
    public class Object24 : Object2
    {
        public int? _80 { get; set; }
        public int? _81 { get; set; }
        public int? _82 { get; set; }
        public int? _83 { get; set; }
        public int? _84 { get; set; }
        public int? _85 { get; set; }
        public int? _86 { get; set; }
        public int? _87 { get; set; }
        public int? _88 { get; set; }
        public int? _89 { get; set; }
        public int? _90 { get; set; }
        public int? _91 { get; set; }
        public int? _92 { get; set; }
        public int? _93 { get; set; }
        public int? _94 { get; set; }
        public int? _95 { get; set; }
        public int? _96 { get; set; }
        public int? _97 { get; set; }
        public int? _98 { get; set; }
        public int? _99 { get; set; }
    }

    [Table("table25")]
    public class Object25 : Object2
    {
        public int? _100 { get; set; }
        public int? _101 { get; set; }
        public int? _102 { get; set; }
        public int? _103 { get; set; }
        public int? _104 { get; set; }
        public int? _105 { get; set; }
        public int? _106 { get; set; }
        public int? _107 { get; set; }
        public int? _108 { get; set; }
        public int? _109 { get; set; }
        public int? _110 { get; set; }
        public int? _111 { get; set; }
        public int? _112 { get; set; }
        public int? _113 { get; set; }
        public int? _114 { get; set; }
        public int? _115 { get; set; }
        public int? _116 { get; set; }
        public int? _117 { get; set; }
        public int? _118 { get; set; }
        public int? _119 { get; set; }
    }

    [Table("table26")]
    public class Object26 : Object2
    {
        public int? _120 { get; set; }
        public int? _121 { get; set; }
        public int? _122 { get; set; }
        public int? _123 { get; set; }
        public int? _124 { get; set; }
        public int? _125 { get; set; }
        public int? _126 { get; set; }
        public int? _127 { get; set; }
        public int? _128 { get; set; }
        public int? _129 { get; set; }
        public int? _130 { get; set; }
        public int? _131 { get; set; }
        public int? _132 { get; set; }
        public int? _133 { get; set; }
        public int? _134 { get; set; }
        public int? _135 { get; set; }
        public int? _136 { get; set; }
        public int? _137 { get; set; }
        public int? _138 { get; set; }
        public int? _139 { get; set; }
    }

    [Table("table27")]
    public class Object27 : Object2
    {
        public int? _140 { get; set; }
        public int? _141 { get; set; }
        public int? _142 { get; set; }
        public int? _143 { get; set; }
        public int? _144 { get; set; }
        public int? _145 { get; set; }
        public int? _146 { get; set; }
        public int? _147 { get; set; }
        public int? _148 { get; set; }
        public int? _149 { get; set; }
        public int? _150 { get; set; }
        public int? _151 { get; set; }
        public int? _152 { get; set; }
        public int? _153 { get; set; }
        public int? _154 { get; set; }
        public int? _155 { get; set; }
        public int? _156 { get; set; }
        public int? _157 { get; set; }
        public int? _158 { get; set; }
        public int? _159 { get; set; }
    }

    [Table("table28")]
    public class Object28 : Object2
    {
        public int? _160 { get; set; }
        public int? _161 { get; set; }
        public int? _162 { get; set; }
        public int? _163 { get; set; }
        public int? _164 { get; set; }
        public int? _165 { get; set; }
        public int? _166 { get; set; }
        public int? _167 { get; set; }
        public int? _168 { get; set; }
        public int? _169 { get; set; }
        public int? _170 { get; set; }
        public int? _171 { get; set; }
        public int? _172 { get; set; }
        public int? _173 { get; set; }
        public int? _174 { get; set; }
        public int? _175 { get; set; }
        public int? _176 { get; set; }
        public int? _177 { get; set; }
        public int? _178 { get; set; }
        public int? _179 { get; set; }
    }

    [Table("table29")]
    public class Object29 : Object2
    {
        public int? _180 { get; set; }

        // This line will cause the program to crash. Remove it and it will work fine.
        public int? _181 { get; set; }
}

Database Context

using System.Data.Entity;

namespace TestProject
{
    public class TestDB : DbContext
    {
        public TestDB()
            : base("name=TESTDBNAME")
        {
        }

        public virtual DbSet<Object1> Object1s { get; set; }
        public virtual DbSet<Object2> Object2s { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<Object1>().HasMany<Object2>(obj1 => obj1.Object2s).WithMany(obj2 => obj2.Object1s).Map(m =>
            {
                m.MapLeftKey("Object1ID");
                m.MapRightKey("Object2ID");
                m.ToTable("table1_table2");
            });
        }
    }

}

I have tried several things to try to fix the error.

I first tried to remove attributes from the classes to try to pinpoint where the issue is coming from. I expected there to be a mismatch between the C# and the MySQL tables, which I could fix. I found that there was no one type of attribute that was causing the error, rather it is the number of attributes that is making it break. 181 nullable ints seems to be the magic number. This number changes depending on the type of attributes.

I tried moving all of the the attributes onto one class (Object2). I expected this to cause the same error, however it did not. I was able to put more than 181 attributes on the class.

I tried having only two classes in the hierarchy Object2 and Object21 (Object21 inherits from Object2). I put more than 181 attributes on Object2 and ran the code. I was not sure what to expect at this point. The code ran fine.

My take away from all of this is that there is a combination of number of derived classes and member variables on those classes that causes an error in MySql.Data.EntityFramework. I'm at a loss at this point and would appreciate any advice or suggestions. Thanks!

About the system:

OS: macOS Monterey 12.5

.NET version: 4.5.2

Mono Version: 6.12.0.113

Database: MySQL 8.0.31

Entity Framework version: 6.4.4

Database Connector: MySql.Data.EntityFramework 8.0.31

Stack Trace

System.NullReferenceException: Object reference not set to an instance of an object
   at MySql.Data.EntityFramework.SelectStatement.AddColumn (MySql.Data.EntityFramework.ColumnFragment column, MySql.Data.EntityFramework.Scope scope) [0x00025] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.Visit (System.Data.Entity.Core.Common.CommandTrees.DbApplyExpression expression) [0x001b5] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.CommandTrees.DbApplyExpression.Accept[TResultType] (System.Data.Entity.Core.Common.CommandTrees.DbExpressionVisitor`1[TResultType] visitor) [0x0000c] in <068a3c4080104e51828ab210be168ae8>:0
   at MySql.Data.EntityFramework.SqlGenerator.VisitInputExpression (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.VisitInputExpressionEnsureSelect (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.Visit (System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression expression) [0x00022] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression.Accept[TResultType] (System.Data.Entity.Core.Common.CommandTrees.DbExpressionVisitor`1[TResultType] visitor) [0x0000c] in <068a3c4080104e51828ab210be168ae8>:0
   at MySql.Data.EntityFramework.SqlGenerator.VisitInputExpression (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.VisitInputExpressionEnsureSelect (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.Visit (System.Data.Entity.Core.Common.CommandTrees.DbSortExpression expression) [0x00022] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.CommandTrees.DbSortExpression.Accept[TResultType] (System.Data.Entity.Core.Common.CommandTrees.DbExpressionVisitor`1[TResultType] visitor) [0x0000c] in <068a3c4080104e51828ab210be168ae8>:0
   at MySql.Data.EntityFramework.SqlGenerator.VisitInputExpression (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.VisitInputExpressionEnsureSelect (System.Data.Entity.Core.Common.CommandTrees.DbExpression e, System.String name, System.Data.Entity.Core.Metadata.Edm.TypeUsage type) [0x00000] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.EntityFramework.SelectGenerator.Visit (System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression expression) [0x00022] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression.Accept[TResultType] (System.Data.Entity.Core.Common.CommandTrees.DbExpressionVisitor`1[TResultType] visitor) [0x0000c] in <068a3c4080104e51828ab210be168ae8>:0
   at MySql.Data.EntityFramework.SelectGenerator.GenerateSQL (System.Data.Entity.Core.Common.CommandTrees.DbCommandTree tree) [0x0001d] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at MySql.Data.MySqlClient.MySqlProviderServices.CreateDbCommandDefinition (System.Data.Entity.Core.Common.DbProviderManifest providerManifest, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree) [0x0005e] in <a7df937072044dd3aaaa8bec6fa57762>:0
   at System.Data.Entity.Core.Common.DbProviderServices.CreateDbCommandDefinition (System.Data.Entity.Core.Common.DbProviderManifest providerManifest, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext) [0x00000] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition (System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext) [0x00034] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor (System.Data.Common.DbProviderFactory storeProviderFactory, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext, System.Data.Entity.Infrastructure.DependencyResolution.IDbDependencyResolver resolver, System.Data.Entity.Core.Query.ResultAssembly.BridgeDataReaderFactory bridgeDataReaderFactory, System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory columnMapFactory) [0x002a7] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.EntityClient.Internal.EntityProviderServices.CreateCommandDefinition (System.Data.Common.DbProviderFactory storeProviderFactory, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext, System.Data.Entity.Infrastructure.DependencyResolution.IDbDependencyResolver resolver) [0x00000] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.EntityClient.Internal.EntityProviderServices.CreateDbCommandDefinition (System.Data.Entity.Core.Common.DbProviderManifest providerManifest, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext) [0x00016] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition (System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext) [0x00034] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.CreateCommandDefinition (System.Data.Entity.Core.Objects.ObjectContext context, System.Data.Entity.Core.Common.CommandTrees.DbQueryCommandTree tree) [0x00042] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.Prepare (System.Data.Entity.Core.Objects.ObjectContext context, System.Data.Entity.Core.Common.CommandTrees.DbQueryCommandTree tree, System.Type elementType, System.Data.Entity.Core.Objects.MergeOption mergeOption, System.Boolean streaming, System.Data.Entity.Core.Objects.Span span, System.Collections.Generic.IEnumerable`1[T] compiledQueryParameters, System.Data.Entity.Core.Common.Utils.AliasGenerator aliasGenerator) [0x00042] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan (System.Nullable`1[T] forMergeOption) [0x00281] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectQuery`1+<>c__DisplayClass41_0[T].<GetResults>b__1 () [0x0000b] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T] (System.Func`1[TResult] func, System.Data.Entity.Infrastructure.IDbExecutionStrategy executionStrategy, System.Boolean startLocalTransaction, System.Boolean releaseConnectionOnSuccess) [0x00087] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectQuery`1+<>c__DisplayClass41_0[T].<GetResults>b__0 () [0x00046] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult] (System.Func`1[TResult] operation) [0x00000] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectQuery`1[T].GetResults (System.Nullable`1[T] forMergeOption) [0x00093] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Core.Objects.ObjectQuery`1[T].<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__31_0 () [0x00000] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Data.Entity.Internal.LazyEnumerator`1[T].MoveNext () [0x00008] in <068a3c4080104e51828ab210be168ae8>:0
   at System.Collections.Generic.List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable) [0x00059] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:1108
   at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00062] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:87
   at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0000e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:30
   at TestProject.Program.Main () [0x00008] in /Users/mikalahmed/Projects/TestProject/TestProject/Program.cs:12

Formatted by https://st.elmah.io


问:
How can I set CORS on the nginx-ingress default backend service?
I am running in kubernetes and I have a default backend service configured, and my apis have their own Ingress objects which seem to be working and have CORS setup correctly.

But if you happen to call a route that isn't covered by one of the paths in the ingress it gives me a CORS error, which I'm assuming is falling back to the default backend.

So the question is, how can I configure the CORS headers for the default backend service when using the nginx-ingress in kubernetes?


问:
How to investigate [execution reverted] error in internal transactions - Goerli etherscan
Please refer to this 'Add Liquidity' transaction on Uniswap V2:

https://goerli.etherscan.io/tx/0x46419e4c70ddfe7a1510e49c568f332e43dc6a29aeb794a46ac8dd95063caff2#internal

You will notice that one of the internal transaction errored and execution reverted but the overall transaction was successfully completed. Looking for ideas to investigate such errors.

I did code inspections to identify if there are any possible causes for revert. Also have a debug event in the transaction and is accessible in the link above


问:
JSON parse error: Cannot deserialize value of type `java.util.HashSet<packagename.Role>` from String value (token `JsonToken.VALUE_STRING`)]
I can change the role of a user just fine in postman but when I am reading to change the role of a user in my frontend angular app, I am getting an error(title of the post) in the console of my spring boot project. What am I doing wrong?

HTML - This is the code am using to change the current role of the user

```<code>  <mat-select #selectRole [value]="roles" [(ngModel)]="roles">
        <mat-select-filter *ngIf="selectRole.focused" [array]="roleInfo" [displayMember]="'roleName'"
          (filteredReturn)="filterRoles =$event">
        </mat-select-filter>
        <mat-option *ngFor="let item of filterRoles" [value]="item.roleName">
          {{item.roleName}}
        </mat-option>
  </mat-select>
</code>```

TS

```<code>    roles: object[] = [];
    userId!: number;

    //This opens a modal so I can change the role of a user
   openEditUserMenu(template: TemplateRef<any>, userId: number, roles: []) {
           this.modalRef = this.modalService.show(template, this.config);
           this.userId = userId;
           this.roles = roles;
           console.log(this.roles, "roles")
  }
</code>```

Body:
I can change the role of a user just fine in postman but when I am reading to change the role of a user in my frontend angular app, I am getting an error(title of the post) in the console of my spring boot project. What am I doing wrong?

HTML - This is the code am using to change the current role of the user

  <mat-select #selectRole [value]="roles" [(ngModel)]="roles">
        <mat-select-filter *ngIf="selectRole.focused" [array]="roleInfo" [displayMember]="'roleName'"
          (filteredReturn)="filterRoles =$event">
        </mat-select-filter>
        <mat-option *ngFor="let item of filterRoles" [value]="item.roleName">
          {{item.roleName}}
        </mat-option>
  </mat-select>

TS

    roles: object[] = [];
    userId!: number;

    //This opens a modal so I can change the role of a user
   openEditUserMenu(template: TemplateRef<any>, userId: number, roles: []) {
           this.modalRef = this.modalService.show(template, this.config);
           this.userId = userId;
           this.roles = roles;
           console.log(this.roles, "roles")
  }


问:
Create 'Export As CSV' Button in Django on HTML Webpage
I currently have a working Django application that has a view that outputs a dataframe and is rendered onto a HTML page. Now, I am trying to create a button on this HTML page that allows the user to download the rendered table to their local downloads folder.

How is this done? I am yet to figure it out after doing lots of research trying to get a table from views to HTML to downloaded as CSV.

Python code in views.py

results_html = results.to_html(index=False)
return render(request, 'output.html', {'results_html': results_html})
```
<p>my current home.html code</p>
<pre class="lang-html prettyprint-override"><code><html lang="en-US">
   <body>
      <table>{{results_html|safe}}</table>
   </body>
</html>
</code>```

I have looked into this and would like more clarification about where to type each thing. I am brand new to Django and still trying to figure out how each file interacts.

Body:
I currently have a working Django application that has a view that outputs a dataframe and is rendered onto a HTML page. Now, I am trying to create a button on this HTML page that allows the user to download the rendered table to their local downloads folder.

How is this done? I am yet to figure it out after doing lots of research trying to get a table from views to HTML to downloaded as CSV.

Python code in views.py

results_html = results.to_html(index=False)
return render(request, 'output.html', {'results_html': results_html})

my current home.html code

{{results_html|safe}}

I have looked into this and would like more clarification about where to type each thing. I am brand new to Django and still trying to figure out how each file interacts.


问:
Why do I get "Failed to open macho file..." when running program under VSCODE but not under normal shell?
I have a C++ program (compiled using CLANG++) that executes CLANG++ to compile another program.  When I run this program using OSX shell it runs fine.  When I run it under VSCODE debug it runs but following message is displayed:  "023-01-12 15:01:02.577820-0800 clang++[10766:1004764] Failed to open macho file at /Library/Developer/CommandLineTools/usr/bin/clang++ for reading: Too many levels of symbolic links".  I'm assuming that this message is coming from CLANG++ but I couldn't swear to that. Note, too, that the return code from clang++ is 0.

The routine that executes the compiler is (Note that I also have a routine that runs the compiled program but there isn't any problem with that):

```<code>void compileit(){
    string codeLoc = "/usr/bin/clang++";
    vector<char *> argv;
    argv.push_back((char *)codeLoc.c_str());
    argv.push_back((char *)"-g");
    argv.push_back((char *)"-std=c++14");
    argv.push_back((char *)"-otest.a");
    argv.push_back((char *)"test.cpp");
    argv.push_back((char *)NULL);

    pid_t pid;
    if ((pid = fork()) < 0) {
        cout << "Fork failed" << endl;
        exit(999);
    }else if (pid > 0) {
        cout << "Launching compiler" << endl;
        int wstatus;
        waitpid(-1, &wstatus, 0);
        if (wstatus == 0){
            cout << "CPP compiled successfully" << endl;
            return;
        }else{
            cout << "Compile of CPP file failed: " << wstatus << endl;
        }
    }else{
        int status = execv(codeLoc.c_str(),&argv[0]);
        cout << "Couldn't launch the compiler" << endl;
        exit(998);
    }
}
type here
</code>```

The program being compiled (by the code above) is:

```<code>#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
    cout << "\nhello world" << endl;
    return 0;
}
type here
</code>```

The launch.json file is:

```<code>{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "C/C++: clang++ build and debug active file",
        "type": "lldb",
        "request": "launch",
        "program": "${workspaceFolder}/main",
        "args": ["-b1"],
        "cwd": "${workspaceFolder}",
        "preLaunchTask": "C/C++: clang++ build active file",
      }
    ]
  }
</code>```

And, the output displayed by VSCODE's terminal when I run the program (including the output when it is run) is:

```<code>Launching compiler
2023-01-12 15:01:02.577820-0800 clang++[10766:1004764] Failed to open macho file at /Library/Developer/CommandLineTools/usr/bin/clang++ for reading: Too many levels of symbolic links
CPP compiled successfully
From main: Launching test.a
test.a completed successfully
From forked main: Launching test.a
carl@McTreehouse test %
hello world
type here
</code>```

A caveat:  I'm new to Stack Overflow so If I've not provided enough or the correct information please let me know and I'll provide updates.  I'm also more of a hobbyist c++ programmer than a professional (my background is Tandem/HP Nonstop TAL/Cobol).

My original code,  which was related to a larger project, exhibited this behavior so I tried to reduce the specifics to the code described above.  I had hoped that something I was doing in the larger context was causing the problem but after getting the specific code to its minimal state the problem persisted.

I spent some time looking at the VSCODE properties but couldn't spot anything that seemed like a problem.  I also went looking for symlinks in the /Library/Developer directory but didn't spot anything (but could have easily missed it).

What I'm concerned about it this behavior showing up randomly when running the larger project from the shell or as a CGI.

Body:
I have a C++ program (compiled using CLANG++) that executes CLANG++ to compile another program.  When I run this program using OSX shell it runs fine.  When I run it under VSCODE debug it runs but following message is displayed:  "023-01-12 15:01:02.577820-0800 clang++[10766:1004764] Failed to open macho file at /Library/Developer/CommandLineTools/usr/bin/clang++ for reading: Too many levels of symbolic links".  I'm assuming that this message is coming from CLANG++ but I couldn't swear to that. Note, too, that the return code from clang++ is 0.

The routine that executes the compiler is (Note that I also have a routine that runs the compiled program but there isn't any problem with that):

void compileit(){
    string codeLoc = "/usr/bin/clang++";
    vector<char *> argv;
    argv.push_back((char *)codeLoc.c_str());
    argv.push_back((char *)"-g");
    argv.push_back((char *)"-std=c++14");
    argv.push_back((char *)"-otest.a");
    argv.push_back((char *)"test.cpp");
    argv.push_back((char *)NULL);

    pid_t pid;
    if ((pid = fork()) < 0) {
        cout << "Fork failed" << endl;
        exit(999);
    }else if (pid > 0) {
        cout << "Launching compiler" << endl;
        int wstatus;
        waitpid(-1, &wstatus, 0);
        if (wstatus == 0){
            cout << "CPP compiled successfully" << endl;
            return;
        }else{
            cout << "Compile of CPP file failed: " << wstatus << endl;
        }
    }else{
        int status = execv(codeLoc.c_str(),&argv[0]);
        cout << "Couldn't launch the compiler" << endl;
        exit(998);
    }
}
type here

The program being compiled (by the code above) is:

#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
    cout << "\nhello world" << endl;
    return 0;
}
type here

The launch.json file is:

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "C/C++: clang++ build and debug active file",
        "type": "lldb",
        "request": "launch",
        "program": "${workspaceFolder}/main",
        "args": ["-b1"],
        "cwd": "${workspaceFolder}",
        "preLaunchTask": "C/C++: clang++ build active file",
      }
    ]
  }

And, the output displayed by VSCODE's terminal when I run the program (including the output when it is run) is:

Launching compiler
2023-01-12 15:01:02.577820-0800 clang++[10766:1004764] Failed to open macho file at /Library/Developer/CommandLineTools/usr/bin/clang++ for reading: Too many levels of symbolic links
CPP compiled successfully
From main: Launching test.a
test.a completed successfully
From forked main: Launching test.a
carl@McTreehouse test %
hello world
type here

A caveat:  I'm new to Stack Overflow so If I've not provided enough or the correct information please let me know and I'll provide updates.  I'm also more of a hobbyist c++ programmer than a professional (my background is Tandem/HP Nonstop TAL/Cobol).

My original code,  which was related to a larger project, exhibited this behavior so I tried to reduce the specifics to the code described above.  I had hoped that something I was doing in the larger context was causing the problem but after getting the specific code to its minimal state the problem persisted.

I spent some time looking at the VSCODE properties but couldn't spot anything that seemed like a problem.  I also went looking for symlinks in the /Library/Developer directory but didn't spot anything (but could have easily missed it).

What I'm concerned about it this behavior showing up randomly when running the larger project from the shell or as a CGI.


问:
Android Beacon Scanner (AltBeacon) has high latency of detecting beacons on Android 11 when internet is Off
Since it's known that scanning beacons shouldn't require an internet connection, we were expecting Android Beacon Library by AltBeacon to detect beacons the same when the device is with or without an internet connection. Unfortunately, this is not the case in Android 11.

We've recently implemented the Android Beacon Library in our app and noticed a significant latency on Android 11 when the device is not connected to the internet (tested on Xiaomi 11). In contrast, on an Android 12 device the beacon detection works fast with or without an internet connection (tested on Xiaomi 12).

The latency seems to be caused by the call of the rangingObserver declared in:

```<code>beaconManager.getRegionViewModel(region).rangedBeacons.observe(this, rangingObserver)
</code>```

It might be worth mentioning that we've also noticed a similar issue in the Beacon Scanner App which also implemented with the Android Beacon Library. Again, without an internet connection, the scanner has a significant latency in rendering the scanning list on an Android 11 device.

Has anyone encountered this issue or has any idea how this can be solved?

Please advise.

See a screenshot of Beacon Scanner App with and without Internet

Replication guidelines:

Use an Android 11 device.

Download the Beacon Scanner App.

Turn off any internet connection on your device (including Mobile Data and Wi-Fi).

Put several beacons in the region.

Launch the Beacon Scanner app and start scanning (important: make sure to kill the app if it was open before).

You should notice that the app is scanning but presents empty results for about a minute or more.

Try to launch the app with an active internet connection (via Mobile Data or Wi-Fi) and you will notice the detection happens instantly.

Body:
Since it's known that scanning beacons shouldn't require an internet connection, we were expecting Android Beacon Library by AltBeacon to detect beacons the same when the device is with or without an internet connection. Unfortunately, this is not the case in Android 11.

We've recently implemented the Android Beacon Library in our app and noticed a significant latency on Android 11 when the device is not connected to the internet (tested on Xiaomi 11). In contrast, on an Android 12 device the beacon detection works fast with or without an internet connection (tested on Xiaomi 12).

The latency seems to be caused by the call of the rangingObserver declared in:

beaconManager.getRegionViewModel(region).rangedBeacons.observe(this, rangingObserver)

It might be worth mentioning that we've also noticed a similar issue in the Beacon Scanner App which also implemented with the Android Beacon Library. Again, without an internet connection, the scanner has a significant latency in rendering the scanning list on an Android 11 device.

Has anyone encountered this issue or has any idea how this can be solved?

Please advise.

See a screenshot of Beacon Scanner App with and without Internet

Replication guidelines:

Use an Android 11 device.

Download the Beacon Scanner App.

Turn off any internet connection on your device (including Mobile Data and Wi-Fi).

Put several beacons in the region.

Launch the Beacon Scanner app and start scanning (important: make sure to kill the app if it was open before).

You should notice that the app is scanning but presents empty results for about a minute or more.

Try to launch the app with an active internet connection (via Mobile Data or Wi-Fi) and you will notice the detection happens instantly.


问:
Wikipedia API - return entire page as JSON
I'm trying to figure out how to use the Wikipedia API to get an entire Wikipedia page in JSON format.

Here is my current query. It's not giving me nearly all the content from the page.

```<code>https://en.wikipedia.org/w/api.php?origin=*&action=query&format=json&formatversion=2&redirects&prop=revisions&rvprop=content&titles=Albert+Einstein
</code>```

Does anybody know how to return a Wikipedia page's entire content as JSON?

All the similar questions I've seen have answers like how to get just the snippet from the Wikipedia page, or just images. I want the entire Wikipedia page in JSON format so it can be parsed by a computer for analysis.

Body:
I'm trying to figure out how to use the Wikipedia API to get an entire Wikipedia page in JSON format.

Here is my current query. It's not giving me nearly all the content from the page.

https://en.wikipedia.org/w/api.php?origin=*&action=query&format=json&formatversion=2&redirects&prop=revisions&rvprop=content&titles=Albert+Einstein

Does anybody know how to return a Wikipedia page's entire content as JSON?

All the similar questions I've seen have answers like how to get just the snippet from the Wikipedia page, or just images. I want the entire Wikipedia page in JSON format so it can be parsed by a computer for analysis.