问:
I want to rotate simple 3D object in iPhone
I want to rotate a simple 3D object (lets say an animal) in my iPhone application. I don't have experience with 3D programing or Game engines. Since I have to finish the task ASAP can anybody say where can find very simple code for this task?

Thanks in advance

答:
Use the following link load 3D obj file and rotate it.

http://iphonedevelopment.blogspot.com/2009/03/wavefront-obj-loader-open-sourced-to.html


来源: stackexchange

问:
Calling functions without making the script launch
The title isnt very accurate i think

Here are my script at the right

Screenshot

It's a bot to automatize some actions. Now i want to add some gui to it but i dont know how.

Like you see at the left, i have " import questions" but cuz of it when I launch the tkinter file, it automatically launches the questions without taking my openBtn code into account.

How can I add gui to each command of my questions.py?

答:
You need to break your questions.py script into actual  functions .  Python will simply execute all actions in questions.py when the namespace is imported before it reaches the logic below the import statements in testkinter.py.

So in questions.py remove your while True: statements in favor of function definitions like:

def check_database(param):
     database check logic here

Then link the functions defined in questions.py to Tkinter button actions in testkinter.py like this:

w = tkinter.Button( fenetre, command=check_database )

ContentLicense: CC BY-SA 4.0


问:
Not passing Data from service method to the mongoose get route to query for data using Angular IO
I am getting the data from the template to the component layer, then passing it to the service file. I see it in the console.log() on both levels. When I pass the variable in the method next to the route I want to hit in the server it is not getting passed or I am not accessing it correctly(probably the case) and I have bent this every way I know how.

When I console.log() in the NodeJS server (using express, body-parser, and mongoose) it returns {} with req.body , and undefined if I try to add a key on the end. With just req I get a HUGE responce but parsing through all the info all I can really see is the method key/value and the key/value of the route I am trying to access with my service file method.

I have tried everything I can think of I used the route in postman and it worked fine.

I console.loged req req.params and req.URL with no success.

The other files (component and service) are console.logging the data so I know it is being passed from a *ngFor in the template that is returning a query of all the 'tasks' stored in the database ( keys are title, description, and a default setting of false ). I really do not know what else to do.

I also had the same problem yesterday using a delete method and the findByIdAndDelete mongoose method. The id was being passed as a string from the template all the way to the service file but for some reason was not showing up in req, req.body, or req.body._id. The console.log() in the component and service file displayed this.

```<code>{ mongoose express / using json with the body-parser to return data}

app.get('/task-info', function(req, res){
    console.log('SERVER_:', req.body._id);
    Task.findById({_id: req.body.id}, function(err, task) {
        if(err){
            console.log('ERROR_QUERY_FOR_DATA_INFO:', err)
            res.json({message: 'ERROR_QUERY_FOR_DATA_INFO', data: err})
        } else {
            console.log('SUCCESS_QUERY_ONE_TASK_INFO');
            res.json({message: 'SUCCESS_QUERY_ONE_TASK_INFO', data: task})
        }
    })
})

{ http.service.ts    the console.log() is returning the task id }

 getTaskInfo(task) {
      console.log('SINGLE_TASK_INFO_SERVICE_FILE:', task._id);
      return this._http.get('task-info', task);
  }

{ app.component.ts    the console.log() is returning the entire task }

singleTask(task: any) {
      const observable = this._httpService.getTaskInfo(task);
      observable.subscribe(data => {
        console.log('SINGLE_TASK: ', data);
    });
  }

----The app.component.html----

<div>
        <h1>Tasks</h1>
        <ul *ngIf="allTasksList" class="all-tasks-ul">
            <li *ngFor="let task of allTasksList.tasks">{{ task.title }}
                <div class="edit-task-btn">
                    <button (click)="singleTask(task)">Info</button>
                </div>
                <div class="info-task-btn">
                    <button (click)="changeTask(task)">Edit</button>
                </div>
                <div class="delete-task-btn">
                    <button (click)="deleteOneTask(task._id)">Delete</button>
                </div>
            </li>
            <div *ngIf="editTask" class="editing-task-div">
                <h1>Editing {{ editTask.title }}</h1>
                <form (submit)="updateTask(editTask)">
                    <label>
                        Update Task:
                        <input type="text" name="editTask.title" [(ngModel)]="editTask.title" id="">
                    </label><br>
                    <label>
                        Update Task Description:
                        <input type="text" name="editTask.description" [(ngModel)]="editTask.description" id="">
                    </label><br>
                    <input type="submit" value="Update Task">
                </form>
            </div>
        </ul>
    </div>
</code>```

SERVER_: undefined

this is what the conole is printing, then the error from the bad query. Like I said, in POSTMAN the same get retrieves the data.

答:
Firstly, You don't send body to GET Request never do that just send params or query params like this:

```<code>router.get('/getPost/:id', (req, res, next) => {
    let id = req.params.id;
    // Make your Query Here
})
</code>```

In your Angular side use this

```<code>let id = task.id;
this._httpService.get(`task-info/${id}`);
</code>```

Body:
I am getting the data from the template to the component layer, then passing it to the service file. I see it in the console.log() on both levels. When I pass the variable in the method next to the route I want to hit in the server it is not getting passed or I am not accessing it correctly(probably the case) and I have bent this every way I know how.

When I console.log() in the NodeJS server (using express, body-parser, and mongoose) it returns {} with req.body , and undefined if I try to add a key on the end. With just req I get a HUGE responce but parsing through all the info all I can really see is the method key/value and the key/value of the route I am trying to access with my service file method.

I have tried everything I can think of I used the route in postman and it worked fine.

I console.loged req req.params and req.URL with no success.

The other files (component and service) are console.logging the data so I know it is being passed from a *ngFor in the template that is returning a query of all the 'tasks' stored in the database ( keys are title, description, and a default setting of false ). I really do not know what else to do.

I also had the same problem yesterday using a delete method and the findByIdAndDelete mongoose method. The id was being passed as a string from the template all the way to the service file but for some reason was not showing up in req, req.body, or req.body._id. The console.log() in the component and service file displayed this.

{ mongoose express / using json with the body-parser to return data}

app.get('/task-info', function(req, res){
    console.log('SERVER_:', req.body._id);
    Task.findById({_id: req.body.id}, function(err, task) {
        if(err){
            console.log('ERROR_QUERY_FOR_DATA_INFO:', err)
            res.json({message: 'ERROR_QUERY_FOR_DATA_INFO', data: err})
        } else {
            console.log('SUCCESS_QUERY_ONE_TASK_INFO');
            res.json({message: 'SUCCESS_QUERY_ONE_TASK_INFO', data: task})
        }
    })
})

{ http.service.ts    the console.log() is returning the task id }

 getTaskInfo(task) {
      console.log('SINGLE_TASK_INFO_SERVICE_FILE:', task._id);
      return this._http.get('task-info', task);
  }

{ app.component.ts    the console.log() is returning the entire task }

singleTask(task: any) {
      const observable = this._httpService.getTaskInfo(task);
      observable.subscribe(data => {
        console.log('SINGLE_TASK: ', data);
    });
  }

----The app.component.html----

Tasks

{{ task.title }}

                    <button (click)="singleTask(task)">Info</button>

                    <button (click)="changeTask(task)">Edit</button>

                    <button (click)="deleteOneTask(task._id)">Delete</button>

Editing {{ editTask.title }}

                <form (submit)="updateTask(editTask)">

                        Update Task:
                        <input type="text" name="editTask.title" [(ngModel)]="editTask.title" id="">

                        Update Task Description:
                        <input type="text" name="editTask.description" [(ngModel)]="editTask.description" id="">

                    <input type="submit" value="Update Task">
                </form>

SERVER_: undefined

this is what the conole is printing, then the error from the bad query. Like I said, in POSTMAN the same get retrieves the data.

Body:
Firstly, You don't send body to GET Request never do that just send params or query params like this:

router.get('/getPost/:id', (req, res, next) => {
    let id = req.params.id;
    // Make your Query Here
})

In your Angular side use this

let id = task.id;
this._httpService.get(`task-info/${id}`);


问:
How to change counting label text in Swift 5
```<code>class ViewController: UIViewController {
    var flipCount = 0

    @IBAction func card1(_ sender: UIButton) {
        flipCount += 1
        flipCard(emoje: "☠" , button: sender)
    }

    @IBAction func card2(_ sender: UIButton) {
        flipCount += 1
        flipCard(emoje: "", button: sender)
    }

    @IBOutlet weak var counter: UILabel!
}
</code>```

How can I link my counter to my UI? I can't put flipcountLabel.text.

答:
You should use the UILabel instance counter

```<code>@IBAction func card1(_ sender: UIButton) {
    flipCount += 1
    counter.text = \(flipCount)
    flipCard(emoje: "☠" , button: sender)
}

@IBAction func card2(_ sender: UIButton) {
    flipCount += 1
    counter.text = \(flipCount)
    flipCard(emoje: "", button: sender)
}
</code>```

Body:
class ViewController: UIViewController {
    var flipCount = 0

    @IBAction func card1(_ sender: UIButton) {
        flipCount += 1
        flipCard(emoje: "☠" , button: sender)
    }

    @IBAction func card2(_ sender: UIButton) {
        flipCount += 1
        flipCard(emoje: "", button: sender)
    }

    @IBOutlet weak var counter: UILabel!
}

How can I link my counter to my UI? I can't put flipcountLabel.text.

Body:
You should use the UILabel instance counter

@IBAction func card1(_ sender: UIButton) {
    flipCount += 1
    counter.text = \(flipCount)
    flipCard(emoje: "☠" , button: sender)
}

@IBAction func card2(_ sender: UIButton) {
    flipCount += 1
    counter.text = \(flipCount)
    flipCard(emoje: "", button: sender)
}


问:
Entity Framework Casting Error
The following works perfectly:

```<code>IQueryable<Property> PropertyQuery = PropertyDAO.SearchWithAdditionalParameters(/* elided */);
IQueryable<long> propertyIdQuery = PropertyQuery.Select(p => p.PropertyId);

var relevantFMVs = PropertyDAO.db.FMVHistories.Where(f => propertyIdQuery.Contains(f.PropertyId)).ToList();
</code>```

But the following blows up:

```<code>IQueryable<Property> PropertyQuery = PropertyDAO.SearchWithAdditionalParameters(/* elided */);

var relevantFMVs = PropertyDAO.db.FMVHistories.Where(f => PropertyQuery.Select(p => p.PropertyId).Contains(f.PropertyId)).ToList();
</code>```

(note that instead of creating propertyIdQuery separately, I just substituted the query itself where the variable had been)

Exception is

Unable to cast the type
  'System.Linq.IQueryable1' to type
  'System.Linq.IQueryable1'. LINQ to
  Entities only supports casting Entity
  Data Model primitive types.

Can someone shed some light on what EF (4) is doing under the covers to make only the first query work, even though they're ostensibly equivalent?

I know IQueryable<T> and Expression Trees do a lot of stuff under the covers, but how is it that saving an intermediate step into a local variable would affect the outcome?

EDIT

By request, here's the full method that's being called, and the methods that that method calls:

```<code>    public IQueryable<Property> BasicSearchFromConstraints(PropertyInvoiceConstraints constraints) {
        return ExecuteSearchFromConstraints((dynamic)constraints.PropertyInst, constraints.CompanyNumber, constraints.TaxSubType, constraints.PhaseID, constraints.State, constraints.County, constraints.City, constraints.Jurisdiction);
    }

    private IQueryable<T> ExecuteSearchFromConstraints<T>(T property, int CompanyNumber, byte SubType, byte PhaseID, string State, string County, string City, string Jurisdiction) where T : Property {
        IQueryable<T> result = base.db.Properties.OfType<T>();

        if (SubType > 0)
            result = result.Where(p => p.TaxSubTypeId == SubType);
        if (CompanyNumber > 0)
            result = result.Where(p => p.CompanyNum == CompanyNumber);
        if (!String.IsNullOrEmpty(State))
            result = result.Where(p => p.State == State);
        if (!String.IsNullOrEmpty(County))
            result = result.Where(p => p.County == County);
        if (!String.IsNullOrEmpty(City))
            result = result.Where(p => p.City == City);
        if (!String.IsNullOrEmpty(Jurisdiction))
            result = result.Where(p => p.Jurisdiction == Jurisdiction);

        if (PhaseID > 0)
            result = result.Where(p => p.PhaseId == PhaseID);

        return result;
    }

    public virtual IQueryable<Property> SearchWithAdditionalParameters(DataLayer.DAO.PropertyInvoiceConstraints constraints, string propertyNumber = "", string altDesc = "", string countyAcctNumber = "", string City = "", string Jurisdiction = "", string secondaryStateID = "", string LegalDesc = "", string status = "", int? TaxYear = null) {
        IQueryable<Property> result = BasicSearchFromConstraints(constraints);

        if (!String.IsNullOrEmpty(status))
            result = result.Where(p => p.Status == status);

        if (!String.IsNullOrEmpty(propertyNumber))
            result = result.Where(p => p.PropertyNum.Contains(propertyNumber));

        if (!String.IsNullOrEmpty(altDesc))
            result = result.Where(p => p.AltDescription.Contains(altDesc));

        if (!String.IsNullOrEmpty(countyAcctNumber))
            result = result.Where(p => p.CountyAccountNum.Contains(countyAcctNumber));

        if (!String.IsNullOrEmpty(City))
            result = result.Where(p => p.City.Contains(City));

        if (!String.IsNullOrEmpty(Jurisdiction))
            result = result.Where(p => p.Jurisdiction.Contains(Jurisdiction));

        if (TaxYear.HasValue)
            result = result.Where(p => p.FMVHistories.Any(f => f.TaxYear == TaxYear));

        if (constraints.FMVPhaseID > 0)
            result = result.Where(p => p.FMVHistories.Any(f => f.PhaseId == constraints.FMVPhaseID));

        if (!String.IsNullOrEmpty(secondaryStateID))
            if (constraints.PropertyInst is WellDetail)
                result = result.OfType<WellDetail>().Where(w => w.SecondaryStateId == secondaryStateID);
            else
                throw new ApplicationException("Invalid use -> Secondary State ID can only be set when searching for Well property types");

        if (!String.IsNullOrEmpty(LegalDesc))
            if (constraints.PropertyInst is RealEstateDetail)
                result = result.OfType<RealEstateDetail>().Where(r => r.LegalDescr.Contains(LegalDesc));
            else if (constraints.PropertyInst is RealEstateServicingDetail)
                result = result.OfType<RealEstateServicingDetail>().Where(r => r.LegalDescr.Contains(LegalDesc));
            else throw new ApplicationException("Invalid use -> Legal Description can only be set when searching for either real estate or real estate servicing property types");

        return result;
    }
</code>```

EDIT

I really wanted Akash's answer to be correct, but if it was, I would expect the middle query here to blow up, but in fact all three work just fine.

I'm beginning to suspect that the inheritance structure I have on type Property (from the original example) might have something to do with this.

```<code>        DummyBookModelEntities db = new DummyBookModelEntities();

        IQueryable<int> BookIds = db.Books.Where(b => b.id < 4).Select(b => b.id);
        IQueryable<Book> BooksFromIdQuery = db.Books.Where(b => b.id < 4);

        try {
            var l1 = db.Books.Where(b => BookIds.Contains(b.id)).ToList();
            Console.WriteLine("ID Query With ID Local Var Worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("ID Query Failed:");
            Console.WriteLine(E.ToString());
            Console.WriteLine();
        }

        try {
            var l1 = db.Books.Where(b => BooksFromIdQuery.Select(b_inner => b_inner.id).Contains(b.id)).ToList();
            Console.WriteLine("ID Query With Whole Book Local Var Worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("ID Query With Whole Book Local Var Failed:");
            Console.WriteLine(E.ToString());
            Console.WriteLine();
        }

        try {
            var l1 = db.Books.Where(b => BooksFromIdQuery.Contains(b)).ToList();
            Console.WriteLine("Whole Book sub query without select worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("Whole Book sub query without select:");
            Console.WriteLine(E.ToString());
            Console.WriteLine();
        }
</code>```

EDIT

I added in some inheritance, and now the bottom two queries fail.  It looks like any time you have an OfType() in the query, EF simply does not want to parse through entire queries within queries; you have to break out your sub-steps into local variables.

I'll award Akash the bounty tonight unless someone has something else to add.

```<code>        DummyBookModelEntities db = new DummyBookModelEntities();

        IQueryable<int> BookIds = db.Books.OfType<SciFiBook>().Where(b => b.id < 4).Select(b => b.id);
        IQueryable<Book> BooksFromIdQuery = db.Books.OfType<SciFiBook>().Where(b => b.id < 4);

        try {
            var l1 = db.Books.Where(b => BookIds.Contains(b.id)).ToList();
            Console.WriteLine("ID Query With ID Local Var Worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("ID Query Failed:");
            Console.WriteLine(E.Message);
            Console.WriteLine();
        }

        try {
            var l1 = db.Books.Where(b => BooksFromIdQuery.Select(b_inner => b_inner.id).Contains(b.id)).ToList();
            Console.WriteLine("ID Query With Whole Book Local Var Worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("ID Query With Whole Book Local Var Failed:");
            Console.WriteLine(E.Message);
            Console.WriteLine();
        }

        try {
            var l1 = db.Books.Where(b => BooksFromIdQuery.Contains(b)).ToList();
            Console.WriteLine("Whole Book sub query without select worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("Whole Book sub query without select:");
            Console.WriteLine(E.Message);
            Console.WriteLine();
        }

        Console.WriteLine();
</code>```

答:
```<code>f => PropertyQuery.Select(p => p.PropertyId).Contains(f.PropertyId)
</code>```

Above is a linq Expression, everything after f=> is an expression tree. Composite Linq can only expand query based on expressions, but not delegates.

Both your statement sets are logically correct but from compiler's perspective they are different. If you notice your expanded (where on where or select) will only work on same type of template parameter. Where else your IQueryable of int will not work as your linq is expecting IQueryable of T.

Secondly, when you are performing Select on T, and returning IQueryable of T, there is no way runtime to know that earlier T was of what type.

In short, saving intermediate step as local variable breaks your expression tree. I suggest you look at Reflector to see source code of what is actually generated.

Your entire lambda expression is actually built using expression node and entire tree is built and given back to Where method. Where else in your first example, expression tree is different, it involves execution of something else within an expression.

ContentLicense: CC BY-SA 3.0

Title: Entity Framework Casting Error

Body:
The following works perfectly:

IQueryable<Property> PropertyQuery = PropertyDAO.SearchWithAdditionalParameters(/* elided */);
IQueryable<long> propertyIdQuery = PropertyQuery.Select(p => p.PropertyId);

var relevantFMVs = PropertyDAO.db.FMVHistories.Where(f => propertyIdQuery.Contains(f.PropertyId)).ToList();

But the following blows up:

IQueryable<Property> PropertyQuery = PropertyDAO.SearchWithAdditionalParameters(/* elided */);

var relevantFMVs = PropertyDAO.db.FMVHistories.Where(f => PropertyQuery.Select(p => p.PropertyId).Contains(f.PropertyId)).ToList();

(note that instead of creating propertyIdQuery separately, I just substituted the query itself where the variable had been)

Exception is

Unable to cast the type
  'System.Linq.IQueryable1' to type
  'System.Linq.IQueryable1'. LINQ to
  Entities only supports casting Entity
  Data Model primitive types.

Can someone shed some light on what EF (4) is doing under the covers to make only the first query work, even though they're ostensibly equivalent?

I know IQueryable<T> and Expression Trees do a lot of stuff under the covers, but how is it that saving an intermediate step into a local variable would affect the outcome?

EDIT

By request, here's the full method that's being called, and the methods that that method calls:

    public IQueryable<Property> BasicSearchFromConstraints(PropertyInvoiceConstraints constraints) {
        return ExecuteSearchFromConstraints((dynamic)constraints.PropertyInst, constraints.CompanyNumber, constraints.TaxSubType, constraints.PhaseID, constraints.State, constraints.County, constraints.City, constraints.Jurisdiction);
    }

    private IQueryable<T> ExecuteSearchFromConstraints<T>(T property, int CompanyNumber, byte SubType, byte PhaseID, string State, string County, string City, string Jurisdiction) where T : Property {
        IQueryable<T> result = base.db.Properties.OfType<T>();

        if (SubType > 0)
            result = result.Where(p => p.TaxSubTypeId == SubType);
        if (CompanyNumber > 0)
            result = result.Where(p => p.CompanyNum == CompanyNumber);
        if (!String.IsNullOrEmpty(State))
            result = result.Where(p => p.State == State);
        if (!String.IsNullOrEmpty(County))
            result = result.Where(p => p.County == County);
        if (!String.IsNullOrEmpty(City))
            result = result.Where(p => p.City == City);
        if (!String.IsNullOrEmpty(Jurisdiction))
            result = result.Where(p => p.Jurisdiction == Jurisdiction);

        if (PhaseID > 0)
            result = result.Where(p => p.PhaseId == PhaseID);

        return result;
    }

    public virtual IQueryable<Property> SearchWithAdditionalParameters(DataLayer.DAO.PropertyInvoiceConstraints constraints, string propertyNumber = "", string altDesc = "", string countyAcctNumber = "", string City = "", string Jurisdiction = "", string secondaryStateID = "", string LegalDesc = "", string status = "", int? TaxYear = null) {
        IQueryable<Property> result = BasicSearchFromConstraints(constraints);

        if (!String.IsNullOrEmpty(status))
            result = result.Where(p => p.Status == status);

        if (!String.IsNullOrEmpty(propertyNumber))
            result = result.Where(p => p.PropertyNum.Contains(propertyNumber));

        if (!String.IsNullOrEmpty(altDesc))
            result = result.Where(p => p.AltDescription.Contains(altDesc));

        if (!String.IsNullOrEmpty(countyAcctNumber))
            result = result.Where(p => p.CountyAccountNum.Contains(countyAcctNumber));

        if (!String.IsNullOrEmpty(City))
            result = result.Where(p => p.City.Contains(City));

        if (!String.IsNullOrEmpty(Jurisdiction))
            result = result.Where(p => p.Jurisdiction.Contains(Jurisdiction));

        if (TaxYear.HasValue)
            result = result.Where(p => p.FMVHistories.Any(f => f.TaxYear == TaxYear));

        if (constraints.FMVPhaseID > 0)
            result = result.Where(p => p.FMVHistories.Any(f => f.PhaseId == constraints.FMVPhaseID));

        if (!String.IsNullOrEmpty(secondaryStateID))
            if (constraints.PropertyInst is WellDetail)
                result = result.OfType<WellDetail>().Where(w => w.SecondaryStateId == secondaryStateID);
            else
                throw new ApplicationException("Invalid use -> Secondary State ID can only be set when searching for Well property types");

        if (!String.IsNullOrEmpty(LegalDesc))
            if (constraints.PropertyInst is RealEstateDetail)
                result = result.OfType<RealEstateDetail>().Where(r => r.LegalDescr.Contains(LegalDesc));
            else if (constraints.PropertyInst is RealEstateServicingDetail)
                result = result.OfType<RealEstateServicingDetail>().Where(r => r.LegalDescr.Contains(LegalDesc));
            else throw new ApplicationException("Invalid use -> Legal Description can only be set when searching for either real estate or real estate servicing property types");

        return result;
    }

EDIT

I really wanted Akash's answer to be correct, but if it was, I would expect the middle query here to blow up, but in fact all three work just fine.

I'm beginning to suspect that the inheritance structure I have on type Property (from the original example) might have something to do with this.

        DummyBookModelEntities db = new DummyBookModelEntities();

        IQueryable<int> BookIds = db.Books.Where(b => b.id < 4).Select(b => b.id);
        IQueryable<Book> BooksFromIdQuery = db.Books.Where(b => b.id < 4);

        try {
            var l1 = db.Books.Where(b => BookIds.Contains(b.id)).ToList();
            Console.WriteLine("ID Query With ID Local Var Worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("ID Query Failed:");
            Console.WriteLine(E.ToString());
            Console.WriteLine();
        }

        try {
            var l1 = db.Books.Where(b => BooksFromIdQuery.Select(b_inner => b_inner.id).Contains(b.id)).ToList();
            Console.WriteLine("ID Query With Whole Book Local Var Worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("ID Query With Whole Book Local Var Failed:");
            Console.WriteLine(E.ToString());
            Console.WriteLine();
        }

        try {
            var l1 = db.Books.Where(b => BooksFromIdQuery.Contains(b)).ToList();
            Console.WriteLine("Whole Book sub query without select worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("Whole Book sub query without select:");
            Console.WriteLine(E.ToString());
            Console.WriteLine();
        }

EDIT

I added in some inheritance, and now the bottom two queries fail.  It looks like any time you have an OfType() in the query, EF simply does not want to parse through entire queries within queries; you have to break out your sub-steps into local variables.

I'll award Akash the bounty tonight unless someone has something else to add.

        DummyBookModelEntities db = new DummyBookModelEntities();

        IQueryable<int> BookIds = db.Books.OfType<SciFiBook>().Where(b => b.id < 4).Select(b => b.id);
        IQueryable<Book> BooksFromIdQuery = db.Books.OfType<SciFiBook>().Where(b => b.id < 4);

        try {
            var l1 = db.Books.Where(b => BookIds.Contains(b.id)).ToList();
            Console.WriteLine("ID Query With ID Local Var Worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("ID Query Failed:");
            Console.WriteLine(E.Message);
            Console.WriteLine();
        }

        try {
            var l1 = db.Books.Where(b => BooksFromIdQuery.Select(b_inner => b_inner.id).Contains(b.id)).ToList();
            Console.WriteLine("ID Query With Whole Book Local Var Worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("ID Query With Whole Book Local Var Failed:");
            Console.WriteLine(E.Message);
            Console.WriteLine();
        }

        try {
            var l1 = db.Books.Where(b => BooksFromIdQuery.Contains(b)).ToList();
            Console.WriteLine("Whole Book sub query without select worked: count = {0}", l1.Count);
        } catch (Exception E) {
            Console.WriteLine("Whole Book sub query without select:");
            Console.WriteLine(E.Message);
            Console.WriteLine();
        }

        Console.WriteLine();

Body:
f => PropertyQuery.Select(p => p.PropertyId).Contains(f.PropertyId)

Above is a linq Expression, everything after f=> is an expression tree. Composite Linq can only expand query based on expressions, but not delegates.

Both your statement sets are logically correct but from compiler's perspective they are different. If you notice your expanded (where on where or select) will only work on same type of template parameter. Where else your IQueryable of int will not work as your linq is expecting IQueryable of T.

Secondly, when you are performing Select on T, and returning IQueryable of T, there is no way runtime to know that earlier T was of what type.

In short, saving intermediate step as local variable breaks your expression tree. I suggest you look at Reflector to see source code of what is actually generated.

Your entire lambda expression is actually built using expression node and entire tree is built and given back to Where method. Where else in your first example, expression tree is different, it involves execution of something else within an expression.


问:
How to convert multiple d3.csv data into number?
right now after loading csv file I am looping each object within an array and converting one by one.

which looks like

```<code>fulldata.forEach(function(data){
      data.healthcare = +data.healthcare;
      data.a = +data.a;
      data.b = +data.b;
      data.c = +data.c;
    })
</code>```

assume there are about 100 feature that you need to convert into number, is there a way that convert multiple feature into number at once?

答:
D3 v5 introduced a very convenient method, called d3.autoType, which:

For each value in the given object, the trimmed value is computed; the value is then re-assigned as follows:

If empty, then null.

If exactly "true", then true.

If exactly "false", then false.

If exactly "NaN", then NaN.

Otherwise, if coercible to a number, then a number.

Otherwise, if a date-only or date-time string, then a Date.

Otherwise, a string (the original untrimmed value).

It is very handy when you don't have all columns as a numeric value. For instance, using d3.csvParse, you just need:

```<code>const fullData = d3.csvParse("your_CSV_URL_here", d3.autoType);
</code>```

Here is a demo:

const csv = `number,string,date
32,foo,2019-01-21
47,bar,2018-11-19
17,baz,2019-07-28`;

const data = d3.csvParse(csv, d3.autoType);

console.log(data)```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.9.0/d3.min.js"></script></code>```

However, if in fact you have all columns as numeric values, just get all properties inside the row function:

const csv = `foo,bar,baz
12,43,23
75,44,32
76,93,23`;

const data = d3.csvParse(csv, function(d) {
  d3.keys(d).forEach(function(e) {
    d[e] = +d[e]
  })
  return d;
});

console.log(data)```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script></code>```

Body:
right now after loading csv file I am looping each object within an array and converting one by one.

which looks like

fulldata.forEach(function(data){
      data.healthcare = +data.healthcare;
      data.a = +data.a;
      data.b = +data.b;
      data.c = +data.c;
    })

assume there are about 100 feature that you need to convert into number, is there a way that convert multiple feature into number at once?

Body:
D3 v5 introduced a very convenient method, called d3.autoType, which:

For each value in the given object, the trimmed value is computed; the value is then re-assigned as follows:

If empty, then null.

If exactly "true", then true.

If exactly "false", then false.

If exactly "NaN", then NaN.

Otherwise, if coercible to a number, then a number.

Otherwise, if a date-only or date-time string, then a Date.

Otherwise, a string (the original untrimmed value).

It is very handy when you don't have all columns as a numeric value. For instance, using d3.csvParse, you just need:

const fullData = d3.csvParse("your_CSV_URL_here", d3.autoType);

Here is a demo:

const csv = `number,string,date
32,foo,2019-01-21
47,bar,2018-11-19
17,baz,2019-07-28`;

const data = d3.csvParse(csv, d3.autoType);

console.log(data)

<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.9.0/d3.min.js"></script>

However, if in fact you have all columns as numeric values, just get all properties inside the row function:

const csv = `foo,bar,baz
12,43,23
75,44,32
76,93,23`;

const data = d3.csvParse(csv, function(d) {
  d3.keys(d).forEach(function(e) {
    d[e] = +d[e]
  })
  return d;
});

console.log(data)

<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>


问:
Having Issues With onGuildMessageReceived() When Trying to Add Reactions
I'm trying to make the bot I'm coding react on a user's message when it has specific keywords in it. I have about 50 keywords that the bot can react to, but only if they are at the start of the message.

The bot will react with an emote when it's at the start of the user's message but not when it's after the first word.

I've already tried asking the discord for some help but it's pretty apparent that they don't really care to be friendly to newcomers. I've tried changing the argument from "0" to "Message.MAX_CONTENT_LENGTH" which didn't work. I also originally had an ArrayList that I converted into a String that didn't work, and later tried using just a normal List; with the same result. Right now I'm stuck with an extremely unoptimized if/else statement, but I can live with it. I just need it to work.

import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.core.hooks.ListenerAdapter;

public class GuildMessageReceived extends ListenerAdapter {

    public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
        String[] args = event.getMessage().getContentRaw().split("\\s+");

        if (args[0].equalsIgnoreCase("zachary")) {
            event.getMessage().addReaction("").queue();
        } // if
    } // onGuildMessageReceived()
} // GuildMessageReceived
```

<p>I expect the result to be a reaction on the message with the keyword located inside of it at any point, not just at the beginning. Assume that "money" is a keyword.</p>

<p>What I need:</p>

```[6:52 PM] Anon: I have money
|| Reactions: :spy:
```

<p>What I get:</p>

```[6:52 PM] Anon: I have money
|| Reactions: None
```

答:
Your code only reacts if the first message is a keyword because you're splitting by space and then only checking the first element of the array. Convert the array to an List and use contains(). For example:

List<String> words = Arrays.asList(event.getMessage().getContentRaw().split("\\s+"));
if (words.contains("zachary")) {
  event.getMessage().addReaction("").queue();
}
```

<p>If you want to easily check for multiple keywords you can instead use <code>Collections.disjoint()</code>. For example:</p>

<pre class="lang-java prettyprint-override"><code>Set<String> keywords = Set.of("foo", "bar", "baz");
List<String> words = Arrays.asList(event.getMessage().getContentRaw().split("\\s+"));

if (!Collections.disjoint(keywords, words)) {
  event.getMessage().addReaction("").queue();
}
</code>```

Body:
I'm trying to make the bot I'm coding react on a user's message when it has specific keywords in it. I have about 50 keywords that the bot can react to, but only if they are at the start of the message.

The bot will react with an emote when it's at the start of the user's message but not when it's after the first word.

I've already tried asking the discord for some help but it's pretty apparent that they don't really care to be friendly to newcomers. I've tried changing the argument from "0" to "Message.MAX_CONTENT_LENGTH" which didn't work. I also originally had an ArrayList that I converted into a String that didn't work, and later tried using just a normal List; with the same result. Right now I'm stuck with an extremely unoptimized if/else statement, but I can live with it. I just need it to work.

import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.core.hooks.ListenerAdapter;

public class GuildMessageReceived extends ListenerAdapter {

    public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
        String[] args = event.getMessage().getContentRaw().split("\\s+");

        if (args[0].equalsIgnoreCase("zachary")) {
            event.getMessage().addReaction("").queue();
        } // if
    } // onGuildMessageReceived()
} // GuildMessageReceived

I expect the result to be a reaction on the message with the keyword located inside of it at any point, not just at the beginning. Assume that "money" is a keyword.

What I need:

[6:52 PM] Anon: I have money
|| Reactions: :spy:

What I get:

[6:52 PM] Anon: I have money
|| Reactions: None

Body:
Your code only reacts if the first message is a keyword because you're splitting by space and then only checking the first element of the array. Convert the array to an List and use contains(). For example:

List<String> words = Arrays.asList(event.getMessage().getContentRaw().split("\\s+"));
if (words.contains("zachary")) {
  event.getMessage().addReaction("").queue();
}

If you want to easily check for multiple keywords you can instead use Collections.disjoint(). For example:

Set<String> keywords = Set.of("foo", "bar", "baz");
List<String> words = Arrays.asList(event.getMessage().getContentRaw().split("\\s+"));

if (!Collections.disjoint(keywords, words)) {
  event.getMessage().addReaction("").queue();
}


问:
Using SharePoint CSOM inside .Net Core application
I want to get data from SharePoint list by CSOM library on .Net Core MVC application. There are absolutely no problem to achieve that on .Net Framework aplication because Microsoft.SharePoint.Client library contains ExecuteQuery method. Unfortunately .Net Core equivalent not.

I've made Async function

```<code>public async Task<ActionResult> GetRequests()
    {
        ClientContext context = new ClientContext("https://xxx/sites/xxx/");
        List certificatesList = context.Web.Lists.GetByTitle("Items");
        CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
        ListItemCollection items = certificatesList.GetItems(query);
        context.Load(items);
        Task spTask = context.ExecuteQueryAsync();
        await Task.WhenAll(spTask);
        var result = items;
        ...

    }
</code>```

but it seems like it also won't work on .Net Core because it throws

Exception thrown: 'System.InvalidOperationException' in >System.Private.CoreLib.ni.dll

Additional information: Cannot find platform service library. For
  Windows Store application, please include
  Microsoft.SharePoint.Client.Runtime.WindowsStore.dll in the
  application package. For Windows Phone application, please include
  Microsoft.SharePoint.Client.Runtime.WindowsPhone.dll in the
  application package. For Windows application, please install
  Microsoft.SharePoint.Client.Runtime.Windows.dll in the GAC (Global
  Assembly Cache) or make it available for the Windows application.

Does someone use CSOM in .Net Core or should I use REST Api instead?

```<code>  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  }
</code>```

答:
I had this issue. For some reason when you reference the Microsoft.SharePointOnline.CSOM nuget package it used the .net framework dlls rather than the netcore45 dlls.
Here's what I did to work around this:

Download the nuget package https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/

Extract it to a subfolder in your project eg; Dependencies

Reference the correct assemblies

netcore45\Microsoft.SharePoint.Client.Portable.dll
netcore45\Microsoft.SharePoint.Client.Runtime.Portable.dll
net45\Microsoft.SharePoint.Client.Runtime.Windows.dll
netcore45\Microsoft.SharePoint.Client.Runtime.WindowsStore.dll

Oh and if you already have that nuget package do an uninstall-package on it.

Body:
I want to get data from SharePoint list by CSOM library on .Net Core MVC application. There are absolutely no problem to achieve that on .Net Framework aplication because Microsoft.SharePoint.Client library contains ExecuteQuery method. Unfortunately .Net Core equivalent not.

I've made Async function

public async Task<ActionResult> GetRequests()
    {
        ClientContext context = new ClientContext("https://xxx/sites/xxx/");
        List certificatesList = context.Web.Lists.GetByTitle("Items");
        CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
        ListItemCollection items = certificatesList.GetItems(query);
        context.Load(items);
        Task spTask = context.ExecuteQueryAsync();
        await Task.WhenAll(spTask);
        var result = items;
        ...

    }

but it seems like it also won't work on .Net Core because it throws

Exception thrown: 'System.InvalidOperationException' in >System.Private.CoreLib.ni.dll

Additional information: Cannot find platform service library. For
  Windows Store application, please include
  Microsoft.SharePoint.Client.Runtime.WindowsStore.dll in the
  application package. For Windows Phone application, please include
  Microsoft.SharePoint.Client.Runtime.WindowsPhone.dll in the
  application package. For Windows application, please install
  Microsoft.SharePoint.Client.Runtime.Windows.dll in the GAC (Global
  Assembly Cache) or make it available for the Windows application.

Does someone use CSOM in .Net Core or should I use REST Api instead?

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  }


问:
java.lang.ArrayIndexOutOfBoundsException in facebook accountkit
We are getting following error in account kit.
 It would be very helpful if someone can tell its cause and how to fix it.

```<code>java.lang.RuntimeException:
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4155)
  at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:4246)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3360)
  at android.app.ActivityThread.access$1100 (ActivityThread.java:221)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1794)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:158)
  at android.app.ActivityThread.main (ActivityThread.java:7225)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

Caused by: java.lang.ArrayIndexOutOfBoundsException:
  at com.facebook.accountkit.ui.PhoneCountryCodeAdapter.getItem (PhoneCountryCodeAdapter.java:253)
  at com.facebook.accountkit.ui.PhoneContentController$TopFragment.setPhoneNumberText (PhoneContentController.java:435)
  at com.facebook.accountkit.ui.PhoneContentController$TopFragment.onViewReadyWithState (PhoneContentController.java:362)
  at com.facebook.accountkit.ui.ViewStateFragment.onActivityCreated (ViewStateFragment.java:66)
  at com.facebook.accountkit.ui.PhoneContentController$TopFragment.onActivityCreated (PhoneContentController.java:201)
  at android.app.Fragment.performActivityCreated (Fragment.java:2289)
  at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1007)
  at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1163)
  at android.app.BackStackRecord.run (BackStackRecord.java:793)
  at android.app.FragmentManagerImpl.execPendingActions (FragmentManager.java:1552)
  at android.app.FragmentController.execPendingActions (FragmentController.java:325)
  at android.app.Activity.performResume (Activity.java:7014)
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4144)
</code>```

So the line     Caused by: java.lang.ArrayIndexOutOfBoundsException:
      at com.facebook.accountkit.ui.PhoneCountryCodeAdapter.getItem is caused due to piece of code written in the facebook library? Or it is something we can control and somehow change in through using the configuration files etc?

We are just using the https://developers.facebook.com/docs/accountkit/android in our app. It is working fine many devices, but some devices are getting above error.

Following the code for onCreate in the activity which is calling accountkit. And we are not using onResume.

```<code>SkinManager uiManager = new SkinManager(
               SkinManager.Skin.CONTEMPORARY,
               getResources().getColor(R.color.colorPrimary),
               R.drawable.login_bg2,
               SkinManager.Tint.WHITE,
               0.55D);

       intent = new Intent(this, AccountKitActivity.class);

       AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
               new AccountKitConfiguration.AccountKitConfigurationBuilder(
                       LoginType.PHONE,
                       AccountKitActivity.ResponseType.TOKEN); // or .ResponseType.TOKEN

       configurationBuilder.setSMSWhitelist(new String[]{"PK"});
       configurationBuilder.setUIManager(uiManager);
       intent.putExtra(
               AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
               configurationBuilder.build());
</code>```

Response
Starting to get the response.

```<code>startActivityForResult(intent, APP_REQUEST_CODE);
</code>```

And here we are processing the response

```<code>    @Override
        protected void onActivityResult(
                final int requestCode,
                final int resultCode,
                final Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if (requestCode == APP_REQUEST_CODE) {
                btnContinue.setEnabled(true);
                // confirm that this response matches your request
                final AccountKitLoginResult loginResult = data.getParcelableExtra(AccountKitLoginResult.RESULT_KEY);
                if (loginResult.getError() != null) {
                } else if (loginResult.wasCancelled()) {
                } else {
                    progressDialog.show();
                    if(loginResult.getAccessToken()!=null){
                        fbAccessToken = loginResult.getAccessToken().getToken();
                    }

                    AccountKit.getCurrentAccount(new AccountKitCallback<Account>() {
                        @Override
                        public void onSuccess(Account account) {
                            PhoneNumber phoneNumber = account.getPhoneNumber();
                            phoneNumberString = phoneNumber.getPhoneNumber();
 // some bla bla to call our APIs to save the response
}
                        @Override
                        public void onError(AccountKitError accountKitError) {
                            Log.e(TAG, "onError");
                            progressDialog.hide();
                            Toast.makeText(SignInActivity.this, accountKitError.getUserFacingMessage(), Toast.LENGTH_SHORT).show();
                        }
                    });

                }
            }
        }
</code>```

答:
Here is my final code.

```<code>public class AccountKitLoginManager {
public final static int APP_REQUEST_CODE = 99;
public static void login(Activity activity){
    final Intent intent = new Intent(activity, AccountKitActivity.class);
    AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
            new AccountKitConfiguration.AccountKitConfigurationBuilder(
                    LoginType.PHONE,
                    AccountKitActivity.ResponseType.CODE).setSMSWhitelist(new String[]{"MM"}); // or .ResponseType.TOKEN
    intent.putExtra(
            AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
            configurationBuilder.build());
    activity.startActivityForResult(intent, APP_REQUEST_CODE);
   }
}
</code>```

First error is same to you.Couse of this code String[]{"MM , CN"}.So I remove CN.My program is fine.

Body:
We are getting following error in account kit.
 It would be very helpful if someone can tell its cause and how to fix it.

java.lang.RuntimeException:
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4155)
  at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:4246)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3360)
  at android.app.ActivityThread.access$1100 (ActivityThread.java:221)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1794)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:158)
  at android.app.ActivityThread.main (ActivityThread.java:7225)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

Caused by: java.lang.ArrayIndexOutOfBoundsException:
  at com.facebook.accountkit.ui.PhoneCountryCodeAdapter.getItem (PhoneCountryCodeAdapter.java:253)
  at com.facebook.accountkit.ui.PhoneContentController$TopFragment.setPhoneNumberText (PhoneContentController.java:435)
  at com.facebook.accountkit.ui.PhoneContentController$TopFragment.onViewReadyWithState (PhoneContentController.java:362)
  at com.facebook.accountkit.ui.ViewStateFragment.onActivityCreated (ViewStateFragment.java:66)
  at com.facebook.accountkit.ui.PhoneContentController$TopFragment.onActivityCreated (PhoneContentController.java:201)
  at android.app.Fragment.performActivityCreated (Fragment.java:2289)
  at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1007)
  at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1163)
  at android.app.BackStackRecord.run (BackStackRecord.java:793)
  at android.app.FragmentManagerImpl.execPendingActions (FragmentManager.java:1552)
  at android.app.FragmentController.execPendingActions (FragmentController.java:325)
  at android.app.Activity.performResume (Activity.java:7014)
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4144)

So the line     Caused by: java.lang.ArrayIndexOutOfBoundsException:
      at com.facebook.accountkit.ui.PhoneCountryCodeAdapter.getItem is caused due to piece of code written in the facebook library? Or it is something we can control and somehow change in through using the configuration files etc?

We are just using the https://developers.facebook.com/docs/accountkit/android in our app. It is working fine many devices, but some devices are getting above error.

Following the code for onCreate in the activity which is calling accountkit. And we are not using onResume.

SkinManager uiManager = new SkinManager(
               SkinManager.Skin.CONTEMPORARY,
               getResources().getColor(R.color.colorPrimary),
               R.drawable.login_bg2,
               SkinManager.Tint.WHITE,
               0.55D);

       intent = new Intent(this, AccountKitActivity.class);

       AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
               new AccountKitConfiguration.AccountKitConfigurationBuilder(
                       LoginType.PHONE,
                       AccountKitActivity.ResponseType.TOKEN); // or .ResponseType.TOKEN

       configurationBuilder.setSMSWhitelist(new String[]{"PK"});
       configurationBuilder.setUIManager(uiManager);
       intent.putExtra(
               AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
               configurationBuilder.build());

Response
Starting to get the response.

startActivityForResult(intent, APP_REQUEST_CODE);

And here we are processing the response

    @Override
        protected void onActivityResult(
                final int requestCode,
                final int resultCode,
                final Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if (requestCode == APP_REQUEST_CODE) {
                btnContinue.setEnabled(true);
                // confirm that this response matches your request
                final AccountKitLoginResult loginResult = data.getParcelableExtra(AccountKitLoginResult.RESULT_KEY);
                if (loginResult.getError() != null) {
                } else if (loginResult.wasCancelled()) {
                } else {
                    progressDialog.show();
                    if(loginResult.getAccessToken()!=null){
                        fbAccessToken = loginResult.getAccessToken().getToken();
                    }

                    AccountKit.getCurrentAccount(new AccountKitCallback<Account>() {
                        @Override
                        public void onSuccess(Account account) {
                            PhoneNumber phoneNumber = account.getPhoneNumber();
                            phoneNumberString = phoneNumber.getPhoneNumber();
 // some bla bla to call our APIs to save the response
}
                        @Override
                        public void onError(AccountKitError accountKitError) {
                            Log.e(TAG, "onError");
                            progressDialog.hide();
                            Toast.makeText(SignInActivity.this, accountKitError.getUserFacingMessage(), Toast.LENGTH_SHORT).show();
                        }
                    });

                }
            }
        }

Body:
Here is my final code.

public class AccountKitLoginManager {
public final static int APP_REQUEST_CODE = 99;
public static void login(Activity activity){
    final Intent intent = new Intent(activity, AccountKitActivity.class);
    AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
            new AccountKitConfiguration.AccountKitConfigurationBuilder(
                    LoginType.PHONE,
                    AccountKitActivity.ResponseType.CODE).setSMSWhitelist(new String[]{"MM"}); // or .ResponseType.TOKEN
    intent.putExtra(
            AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
            configurationBuilder.build());
    activity.startActivityForResult(intent, APP_REQUEST_CODE);
   }
}

First error is same to you.Couse of this code String[]{"MM , CN"}.So I remove CN.My program is fine.


问:
Select a Generic Grouping (not static) of Cells
I have a current Excel Macro below which works great for one dataset:

```<code>Sub test_macro()
    Rows("1:1").Select
    Selection.Delete Shift:=xlUp
    Columns("A:A").Select
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
        Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
        :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
        Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1)), _
        TrailingMinusNumbers:=True
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Cut Destination:=Range("B1:K1")
    Columns("A:A").Select
    Selection.Delete Shift:=xlToLeft
End Sub
</code>```

The goal is to take a dataset that looks like this:

And transform it to this:

```<code>| COL1 | COL2 | COL3 | COL4 | COL5 | COL6 | COL7 | COL8 | COL9 | COL10 |
|------|------|------|------|------|------|------|------|------|-------|
| Foo1 | Foo2 | Foo3 | Foo4 | Foo5 | Foo6 | Foo7 | Foo8 | Foo9 | Foo10 |
</code>```

And this works great as is. However, the number of columns I have can change. Sometimes it is only 2 columns, sometimes it is up to 250 columns. Therefore, I am worried about the Range(Selection, Selection.End(xlToRight)).Select
    Selection.Cut Destination:=Range("B1:K1") portion of my macro, since it specifies the paste range to be B1:K1.

Therefore, How can I make that destination range generic? (I am simply shifting over row 1 by 1 to the right for every filled in cell in row 1).

答:
The following worked. I had to specify ranges.</p>

```<code>' This sub opens the workbook
Sub Open_WB()
' Turn off screen updating
Application.ScreenUpdating = False
' Open data
Workbooks.Open "dummy_wip.xlsx"
' Activate data
Dim databook As Workbook
Set databook = Application.Workbooks("dummy_wip.xlsx")

MsgBox ("Got here")

' Format the data per Michelle Barstad Requirements
  Rows("1:1").Select
    Selection.Delete Shift:=xlUp
    Columns("A:A").Select
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
        Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
        :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
        Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1)), _
        TrailingMinusNumbers:=True

    ' Dynamically look for resizing
    Dim seltocut As Range
    Dim seltopaste As Range
    Dim cellstart As Range
    Dim cellfinish As Range

    Set cellstart = Cells(1, 1)
    Set cellfinish = Cells(1, 2)
    Set seltocut = Range(cellstart, cellstart.End(xlToRight))

    Range("B1").Select
    Set seltopaste = Range(cellfinish, cellfinish.End(xlToRight).Offset(, 1))

    seltocut.Cut Destination:=seltopaste
    Columns("A:A").Select
    Selection.Delete Shift:=xlToLeft

End Sub
</code>```

Body:
I have a current Excel Macro below which works great for one dataset:

Sub test_macro()
    Rows("1:1").Select
    Selection.Delete Shift:=xlUp
    Columns("A:A").Select
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
        Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
        :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
        Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1)), _
        TrailingMinusNumbers:=True
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Cut Destination:=Range("B1:K1")
    Columns("A:A").Select
    Selection.Delete Shift:=xlToLeft
End Sub

The goal is to take a dataset that looks like this:

And transform it to this:

| COL1 | COL2 | COL3 | COL4 | COL5 | COL6 | COL7 | COL8 | COL9 | COL10 |
|------|------|------|------|------|------|------|------|------|-------|
| Foo1 | Foo2 | Foo3 | Foo4 | Foo5 | Foo6 | Foo7 | Foo8 | Foo9 | Foo10 |

And this works great as is. However, the number of columns I have can change. Sometimes it is only 2 columns, sometimes it is up to 250 columns. Therefore, I am worried about the Range(Selection, Selection.End(xlToRight)).Select
    Selection.Cut Destination:=Range("B1:K1") portion of my macro, since it specifies the paste range to be B1:K1.

Therefore, How can I make that destination range generic? (I am simply shifting over row 1 by 1 to the right for every filled in cell in row 1).

Body:
The following worked. I had to specify ranges.

' This sub opens the workbook
Sub Open_WB()
' Turn off screen updating
Application.ScreenUpdating = False
' Open data
Workbooks.Open "dummy_wip.xlsx"
' Activate data
Dim databook As Workbook
Set databook = Application.Workbooks("dummy_wip.xlsx")

MsgBox ("Got here")

' Format the data per Michelle Barstad Requirements
  Rows("1:1").Select
    Selection.Delete Shift:=xlUp
    Columns("A:A").Select
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
        Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
        :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
        Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1)), _
        TrailingMinusNumbers:=True

    ' Dynamically look for resizing
    Dim seltocut As Range
    Dim seltopaste As Range
    Dim cellstart As Range
    Dim cellfinish As Range

    Set cellstart = Cells(1, 1)
    Set cellfinish = Cells(1, 2)
    Set seltocut = Range(cellstart, cellstart.End(xlToRight))

    Range("B1").Select
    Set seltopaste = Range(cellfinish, cellfinish.End(xlToRight).Offset(, 1))

    seltocut.Cut Destination:=seltopaste
    Columns("A:A").Select
    Selection.Delete Shift:=xlToLeft

End Sub


问:
C# logic question
I have those boolean values:

```<code>bool test = false && true || true; // true
bool test1 = false && (true || true); // false
</code>```

Now, can anybody explain why this is? Shouldnt those be the same?

Thanks :)

答:
The first evaluates false && true first (false) and then the result with || true, which gives true.

The second evaluates the value in the parenthesis first so true || true and then the result with && false, which gives false

Title: C# logic question

Body:
I have those boolean values:

bool test = false && true || true; // true
bool test1 = false && (true || true); // false

Now, can anybody explain why this is? Shouldnt those be the same?

Thanks :)


问:
How to fit contents perfectly under the flex property?
I have 2 containers that called .grid.left and .grid.right. Each .grids, especially .grid.left has some images dynamical ways and those.grids are wrapped by another div called .gallery.

The problem is when I give margin each of the image boxes, the browser makes a little gaps inside of the .gallery like this:

My expectation is to get rid of that gaps from my .gallery and to make the images fit completely no matter how much I set the margins on the images.

I intended to give the margins for the gallery looking better. I want to remain those margins and expand the .grid.right's image only to fit between the image and the .outer div.

Are there any proper ways to resolve this problem?

CodePen

Snippets:

* {
  margin: 0;
  padding: 0;
}

div,
section {
  position: relative;
}

.gallery {
  width: 1200px;
  height: 100%;
  border: 1px solid black;
  box-sizing: border-box;
}

.article {
  width: 100%;
  height: 100%;
  display: flex;
  flex-flow: row;
  align-items: center;
}

.grid {
  height: 100%;
}

.left {
  width: 60%;
}

.inset-contents {
  width: 100%;
  height: 50%;
}

.top {
  margin-bottom: 1rem;
  background-image: url('https://imgur.com/3ozQvk9.jpg');
  padding-bottom: 50%;
}

.bottom {
  display: flex;
  flex-flow: row;
}

.inner-contents {
  width: 50%;
}

.first {
  background-image: url('https://imgur.com/tOMRVDi.jpg');
  padding-bottom: 50%;
  margin-right: .5rem;
}

.second {
  background-image: url('https://imgur.com/4oewNdx.jpg');
  padding-bottom: 50%;
  margin-left: .5rem;
}

.right {
  width: 40%;
  background-image: url('https://imgur.com/7gB1jHR.jpg');
  padding-bottom: 60%;
  align-content: stretch;
  margin-left: 1rem;
}

.img {
  display: block;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="gallery">
  <div class="article">
    <div class="grid left">

      <div class="inset-contents bottom">

      </div>
    </div>

  </div>
</div></code>```

答:
The issue is how you are managing the height of the right element in your image gallery:

omit setting height: 100% (due to grid class) and the padding-bottom - you can override this by adding height: auto to the right element,

remove align-items: center from the article element and allow the default align-items: stretch to take over - this will stretch and match the height of the right element to the left.

See demo below:

* {
  margin: 0;
  padding: 0;
}

div,
section {
  position: relative;
}

.gallery {
  width: 1200px;
  height: 100%;
  border: 1px solid black;
  box-sizing: border-box;
}

.article {
  width: 100%;
  height: 100%;
  display: flex;
  flex-flow: row;
  /*align-items: center;*/
}

.grid {
  height: 100%;
}

.left {
  width: 60%;
}

.inset-contents {
  width: 100%;
  height: 50%;
}

.top {
  margin-bottom: 1rem;
  background-image: url('https://imgur.com/3ozQvk9.jpg');
  padding-bottom: 50%;
}

.bottom {
  display: flex;
  flex-flow: row;
}

.inner-contents {
  width: 50%;
}

.first {
  background-image: url('https://imgur.com/tOMRVDi.jpg');
  padding-bottom: 50%;
  margin-right: .5rem;
}

.second {
  background-image: url('https://imgur.com/4oewNdx.jpg');
  padding-bottom: 50%;
  margin-left: .5rem;
}

.right {
  width: 40%;
  background-image: url('https://imgur.com/7gB1jHR.jpg');
  /*padding-bottom: 60%;
  align-content: stretch; */
  margin-left: 1rem;
  height: auto; /* added */
}

.img {
  display: block;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="gallery">
  <div class="article">
    <div class="grid left">

      <div class="inset-contents bottom">

      </div>
    </div>

  </div>
</div></code>```

Body:
The issue is how you are managing the height of the right element in your image gallery:

omit setting height: 100% (due to grid class) and the padding-bottom - you can override this by adding height: auto to the right element,

remove align-items: center from the article element and allow the default align-items: stretch to take over - this will stretch and match the height of the right element to the left.

See demo below:

* {
  margin: 0;
  padding: 0;
}

div,
section {
  position: relative;
}

.gallery {
  width: 1200px;
  height: 100%;
  border: 1px solid black;
  box-sizing: border-box;
}

.article {
  width: 100%;
  height: 100%;
  display: flex;
  flex-flow: row;
  /*align-items: center;*/
}

.grid {
  height: 100%;
}

.left {
  width: 60%;
}

.inset-contents {
  width: 100%;
  height: 50%;
}

.top {
  margin-bottom: 1rem;
  background-image: url('https://imgur.com/3ozQvk9.jpg');
  padding-bottom: 50%;
}

.bottom {
  display: flex;
  flex-flow: row;
}

.inner-contents {
  width: 50%;
}

.first {
  background-image: url('https://imgur.com/tOMRVDi.jpg');
  padding-bottom: 50%;
  margin-right: .5rem;
}

.second {
  background-image: url('https://imgur.com/4oewNdx.jpg');
  padding-bottom: 50%;
  margin-left: .5rem;
}

.right {
  width: 40%;
  background-image: url('https://imgur.com/7gB1jHR.jpg');
  /*padding-bottom: 60%;
  align-content: stretch; */
  margin-left: 1rem;
  height: auto; /* added */
}

.img {
  display: block;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}

<div class="gallery">
  <div class="article">
    <div class="grid left">
      <a class="inset-contents top img"></a>
      <div class="inset-contents bottom">
        <a class="inner-contents first img"></a>
        <a class="inner-contents second img"></a>
      </div>
    </div>
    <a class="grid right img"></a>
  </div>
</div>


问:
What is the most practical way of ensuring an AWS DynamoDB doesn't go over free limits or you getting charged?
I want to use a DynamoDB (specifically with boto3) but I want to avoid getting charged? Most practical way to do this? What sort of usage surpasses free limits?</p>

答:
Please note that the AWS Free Tier is intended as a means of trying AWS services. It is not provided to run production systems.

The Free Tier is a pricing discount provided each month, either for the first 12 months of your AWS Account or, for some services, for every month even after 12 months.

If your usage goes beyond the free usage amount for a service, you will be charged the normal cost of the service.

The free usage tier for DynamoDB provides:

25GB of storage (Value: $6.25)

25 Read Capacity Units (Value: Under $0.01)

25 Write Capacity Units (Value: Under $0.02)

So, the free tier is only saving you $6.28/month at best. If you go a little over this amount, you're probably not going to be spending much.


问:
Improve response speed Google sheet script
I have written a form for user to enter. I used code to guide them through the form. For example, after entering Cell A4, it jumps to D4, after D4 it jumps to A5, etc. Even though the execution time (as viewed in execution transcript) is not large (close to 0.1 seconds most of the time) the Google sheet response time is generally about 1 second. It feels quite laggy. Is there a way to improve the responsiveness of Google sheet of this action?

答:
Besides the time that get a method to be executed you should consider the "transport time" (the communication between Google Servers and the user device), the spreadsheet recalculation time and the UI refresh time.

To improve the form users' chances to have a better experience,

avoid or reduce the use of formulas

avoid or reduce the use of volatile functions like NOW()

avoid or reduce of the use of open references like A:A

reduce the length of calculation dependency chains

etc.

Also ask the form users to

remove all the web browser extensions

close all other web browser tabs

close all other local applications

use a very fast Internet connection

etc.

Further reading

Profiling the Performance of a Google App Script

Measuring round trip and execution times from add-ons


问:
Bottom Navigation and Fragment is overlapping
As you can see in this picture

the bottom navigation and the textfields are over lapping.

what could be the cause of this weird behavior of my app?

here is the xml:

```<code><?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".fragment.ApplicationFragment">
    <androidx.core.widget.NestedScrollView
        android:id="@+id/scroll_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:paddingLeft="5dp"
        android:fillViewport="true">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_amount_applied"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/amount_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:inputType="numberDecimal"
                            android:hint="Amount Applied" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:hint="Mode of payment">
                        <AutoCompleteTextView
                            android:id="@+id/filled_exposed_dropdown"
                            android:layout_width="match_parent"
                            android:maxLines="1"
                            android:editable="false"
                            android:layout_height="wrap_content"/>
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_term"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/term_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:inputType="number"
                            android:hint="Term" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
            </LinearLayout>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="INDIVIDUAL INFORMATION"
                android:textSize="20dp"
                android:layout_marginBottom="10dp"/>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_last_name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/lastname_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:hint="Lastname" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_first_name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/firstname_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:hint="Firstname" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_middle_name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/middlename_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:hint="Middlename" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_birthdate"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/birthdate_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:editable="false"
                            android:inputType="date"
                            android:hint="Birthdate" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_age"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/age_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:inputType="number"
                            android:hint="Age" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:hint="Sex">
                        <AutoCompleteTextView
                            android:id="@+id/sex_exposed_dropdown"
                            android:layout_width="match_parent"
                            android:maxLines="1"
                            android:editable="false"
                            android:layout_height="wrap_content"/>
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
            </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</FrameLayout>
</code>```

and this is the activity_main.xml

```<code><com.google.android.material.circularreveal.coordinatorlayout.CircularRevealCoordinatorLayout
    android:id="@+id/frame_container"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="?android:attr/windowBackground"
        app:itemBackground="@color/colorPrimary"
        android:foreground="?attr/selectableItemBackground"
        app:itemIconTint="@android:color/white"
        app:itemTextColor="@android:color/white"
        app:menu="@menu/bottom_nav_menu" />

</com.google.android.material.circularreveal.coordinatorlayout.CircularRevealCoordinatorLayout>
</code>```

by the way I just duplicated, copy and pasted 10 or mor times the Birthdate, Age and sex in order to test if the fragment is scrolling. eventually after I run the app as you can see in the picture the bottom navigation and the text fields are now overlapping.

答:
let's suppose your BottomNavigationView height is 60dp , you can avoid this behavior by adding this attribut to your NestedScrollView

```<code>  android:layout_marginBottom="60dp"
</code>```

Body:
As you can see in this picture

the bottom navigation and the textfields are over lapping.

what could be the cause of this weird behavior of my app?

here is the xml:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".fragment.ApplicationFragment">
    <androidx.core.widget.NestedScrollView
        android:id="@+id/scroll_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:paddingLeft="5dp"
        android:fillViewport="true">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_amount_applied"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/amount_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:inputType="numberDecimal"
                            android:hint="Amount Applied" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:hint="Mode of payment">
                        <AutoCompleteTextView
                            android:id="@+id/filled_exposed_dropdown"
                            android:layout_width="match_parent"
                            android:maxLines="1"
                            android:editable="false"
                            android:layout_height="wrap_content"/>
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_term"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/term_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:inputType="number"
                            android:hint="Term" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
            </LinearLayout>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="INDIVIDUAL INFORMATION"
                android:textSize="20dp"
                android:layout_marginBottom="10dp"/>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_last_name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/lastname_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:hint="Lastname" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_first_name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/firstname_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:hint="Firstname" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_middle_name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/middlename_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:hint="Middlename" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_birthdate"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/birthdate_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:editable="false"
                            android:inputType="date"
                            android:hint="Birthdate" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_age"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/age_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:inputType="number"
                            android:hint="Age" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:hint="Sex">
                        <AutoCompleteTextView
                            android:id="@+id/sex_exposed_dropdown"
                            android:layout_width="match_parent"
                            android:maxLines="1"
                            android:editable="false"
                            android:layout_height="wrap_content"/>
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
            </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</FrameLayout>

and this is the activity_main.xml

<com.google.android.material.circularreveal.coordinatorlayout.CircularRevealCoordinatorLayout
    android:id="@+id/frame_container"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="?android:attr/windowBackground"
        app:itemBackground="@color/colorPrimary"
        android:foreground="?attr/selectableItemBackground"
        app:itemIconTint="@android:color/white"
        app:itemTextColor="@android:color/white"
        app:menu="@menu/bottom_nav_menu" />

</com.google.android.material.circularreveal.coordinatorlayout.CircularRevealCoordinatorLayout>

by the way I just duplicated, copy and pasted 10 or mor times the Birthdate, Age and sex in order to test if the fragment is scrolling. eventually after I run the app as you can see in the picture the bottom navigation and the text fields are now overlapping.

Body:
let's suppose your BottomNavigationView height is 60dp , you can avoid this behavior by adding this attribut to your NestedScrollView

  android:layout_marginBottom="60dp"