问:
Azure Sql Database query
I have created a Database on Azure
I am also able to access Azure Sql database from my local server by setting firewall etc

What I notice is when I do a table schema change e.g Create a new table or add a new column to an existing table, the changes do not reflect on the Azure App (although I can see the latest table changes on Azure SQL database Query editor)

I tried modifying sample TODO app which Azure provide with a default TODO table.

After downloading the App from Azure and running it, App runs without any issues by loading proper data from TODO table.

But when I add a new column/rename column to the existing TODO table, Changes DOT file to add new column in api service and published the service. APP stops displaying data with connection error...

```<code>{Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: The request could not be completed.  (Internal Server Error)
  at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<ThrowInvalidResponse>d__24.MoveNext () [0x001da] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
  at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<SendRequestAsync>d__26.MoveNext () [0x000fc] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<RequestAsync>d__18.MoveNext () [0x000f0] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.MobileServiceTable+<ReadAsync>d__20.MoveNext () [0x0009c] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.MobileServiceTable+<ReadAsync>d__18.MoveNext () [0x00136] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider+<Execute>d__8`1[T].MoveNext () [0x000b2] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider+<Execute>d__7`1[T].MoveNext () [0x000a2] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQuery`1+<ToListAsync>d__33[T].MoveNext () [0x00068] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at MyApp08112017.QSCustomerViewController+<RefreshDataAsync>d__9.MoveNext () [0x0008c] in E:\Workspaces\ATM Project\ZIPs From Azure\MyApp08112017_Xamarin_iOS\MyApp08112017\QSCustomerViewController.cs:33 }
</code>```

答:
at MyApp08112017.QSCustomerViewController+d__9.MoveNext () [0x0008c] in E:\Workspaces\ATM Project\ZIPs From Azure\MyApp08112017_Xamarin_iOS\MyApp08112017\QSCustomerViewController.cs:33 }

Based on the error message, you are using the C# backend for your Azure Mobile Apps. For adding a new table, you need to define the model of your table and create a Table Controller for it. For edit the column(s), you could edit the table model. Before publishing your backend to azure, you need to implement code first migrations, you could manually create the migration file via add-migration and leverage the command update-database to apply the existing migration. Also, you could enable the automatically code first migrations. More details, you could refer to adrian hall's book Implementing Table Controllers. Moverover, you could also check Handling Publish Failures.

Title: Azure Sql Database query

Body:
I have created a Database on Azure
I am also able to access Azure Sql database from my local server by setting firewall etc

What I notice is when I do a table schema change e.g Create a new table or add a new column to an existing table, the changes do not reflect on the Azure App (although I can see the latest table changes on Azure SQL database Query editor)

I tried modifying sample TODO app which Azure provide with a default TODO table.

After downloading the App from Azure and running it, App runs without any issues by loading proper data from TODO table.

But when I add a new column/rename column to the existing TODO table, Changes DOT file to add new column in api service and published the service. APP stops displaying data with connection error...

{Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: The request could not be completed.  (Internal Server Error)
  at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<ThrowInvalidResponse>d__24.MoveNext () [0x001da] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
  at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<SendRequestAsync>d__26.MoveNext () [0x000fc] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<RequestAsync>d__18.MoveNext () [0x000f0] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.MobileServiceTable+<ReadAsync>d__20.MoveNext () [0x0009c] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.MobileServiceTable+<ReadAsync>d__18.MoveNext () [0x00136] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider+<Execute>d__8`1[T].MoveNext () [0x000b2] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQueryProvider+<Execute>d__7`1[T].MoveNext () [0x000a2] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at Microsoft.WindowsAzure.MobileServices.Query.MobileServiceTableQuery`1+<ToListAsync>d__33[T].MoveNext () [0x00068] in <bac65eb8c7d1436299ebf8569aaf78b5>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.93/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <e1bdc71e0615425d8d4ddf5cd7e37d8e>:0
  at MyApp08112017.QSCustomerViewController+<RefreshDataAsync>d__9.MoveNext () [0x0008c] in E:\Workspaces\ATM Project\ZIPs From Azure\MyApp08112017_Xamarin_iOS\MyApp08112017\QSCustomerViewController.cs:33 }


来源: stackexchange

问:
Detect the end of scrollToRow function
How can i detect the end of scrollToRow function in my tableview? i have tried to implement scrollViewDidEndScrollingAnimation function, however it doesn't get called when end of scrollToRow.</p>

答:
You should add the delegate to your Scrollview:</p>

```<code>override func viewDidLoad()
{
    super.viewDidLoad()
    self.scrollview.delegate = self
}
</code>```

ContentLicense: CC BY-SA 3.0

Title: Detect the end of scrollToRow function

Body:
You should add the delegate to your Scrollview:

override func viewDidLoad()
{
    super.viewDidLoad()
    self.scrollview.delegate = self
}


问:
Cannot call a router action from the view
Here are my routes :

```<code>this.route('produits', function(){
  this.route('new');
  this.route('edit', { path: '/:produit_id/edit' }, function() {
    this.route('documents');
  });
});
</code>```

Here is my action in routes/produit/edit/documents.js :

```<code>actions: {
    refreshRoute() {
      this.refresh();
    }
}
</code>```

In document.hbs as soon as I use {{action refreshRoute}}, it result in the following error: Assertion Failed: An action named 'refreshRoute' was not found in (generated produits.edit.documents controller)

Why is it not working, when using the same syntax works in CRUD views?

答: You have defined your action in your route. In order to reach route actions you can use ember-route-action-helper. And instead of {{action 'refreshRoute'}}, you should use {{route-action 'refreshRoute'}} otherwise it will look for the action in the controller.

Body:
Here are my routes :

this.route('produits', function(){
  this.route('new');
  this.route('edit', { path: '/:produit_id/edit' }, function() {
    this.route('documents');
  });
});

Here is my action in routes/produit/edit/documents.js :

actions: {
    refreshRoute() {
      this.refresh();
    }
}

In document.hbs as soon as I use {{action refreshRoute}}, it result in the following error: Assertion Failed: An action named 'refreshRoute' was not found in (generated produits.edit.documents controller)

Why is it not working, when using the same syntax works in CRUD views?


问:
How to get only first 50 files from all subdirectories of a directory in Python?
I am trying to get first 50 .jpg files from different subdirectories of a particular directory. Till now, I have only succedded in getting the path name of all using the following list of commands:

```<code>import os
import os.path

for dirpath, dirnames, filenames in os.walk("."):
    for filename in [f for f in filenames if f.endswith(".jpg")]:
        print os.path.join(dirpath, filename)
</code>```

Can someone please tell as to how to extract only first 50 files from the subdirectories?

答:
Take the first n values of your list comprehension.  If you only want the filename, split on / and take the last element:

```<code>import os
import os.path

n = 50
fext = ".jpg"

for dirpath, dirnames, filenames in os.walk("."):
    for filename in [f for f in filenames if f.endswith(fext)][:n]:
        print (filename)
</code>```

Body:
I am trying to get first 50 .jpg files from different subdirectories of a particular directory. Till now, I have only succedded in getting the path name of all using the following list of commands:

import os
import os.path

for dirpath, dirnames, filenames in os.walk("."):
    for filename in [f for f in filenames if f.endswith(".jpg")]:
        print os.path.join(dirpath, filename)

Can someone please tell as to how to extract only first 50 files from the subdirectories?

Body:
Take the first n values of your list comprehension.  If you only want the filename, split on / and take the last element:

import os
import os.path

n = 50
fext = ".jpg"

for dirpath, dirnames, filenames in os.walk("."):
    for filename in [f for f in filenames if f.endswith(fext)][:n]:
        print (filename)


问:
Oracle to MySQL timestamp conversion in MySQL insert statement
I've already exported data from an Oracle 11g instance as insert statements. They need to go into a MySQL 5.5 instance. Having trouble with the TIMESTAMP conversion; I know I can use the TO_TIMESTAMP function inline with INSERT statements in MySQL; however, am unsure as to the correct flags to use. As follows below, in linear order, is: the Oracle timestamp statement and my attempt at a MySQL compatible statement. Obviously it's not working (in that MySQL states there's a syntax error).

Oracle:

```<code>TO_TIMESTAMP('12/22/2015 5:08:59.245837 PM','fmMMfm/fmDDfm/YYYY fmHH12fm:MI:SS.FF AM')
</code>```

MySQL:

```<code>TO_TIMESTAMP('12/22/2015 5:08:59.245837 PM','%m/%d/%Y %h:%i:%s')
</code>```

What am I missing beyond flags for microseconds and AM/PM?

Body:
I've already exported data from an Oracle 11g instance as insert statements. They need to go into a MySQL 5.5 instance. Having trouble with the TIMESTAMP conversion; I know I can use the TO_TIMESTAMP function inline with INSERT statements in MySQL; however, am unsure as to the correct flags to use. As follows below, in linear order, is: the Oracle timestamp statement and my attempt at a MySQL compatible statement. Obviously it's not working (in that MySQL states there's a syntax error).

Oracle:

TO_TIMESTAMP('12/22/2015 5:08:59.245837 PM','fmMMfm/fmDDfm/YYYY fmHH12fm:MI:SS.FF AM')

MySQL:

TO_TIMESTAMP('12/22/2015 5:08:59.245837 PM','%m/%d/%Y %h:%i:%s')

What am I missing beyond flags for microseconds and AM/PM?

Body:
FOR MYSQL:
STR_TO_DATE('2/6/2015 5:20:43.000000 AM','%c/%d/%Y %l:%i:%s.%f %p')


问:
Making my integer go up by 1 every second
I'm extremely new to c# and I'm wondering how I can make a basic timer that counts up by one using an integer. So far I only have

```<code>int timer = 0;
int max = 10000;

        while ( timer < max )
        {
          timer += 1;

        }
</code>```

I'm assuming this will automatically boost the timer straight to 1000 because there's no speed set. I'm wondering how I can set a speed to this. Thank you.

答:
You can try using C# Timer</p>

```<code>int _counter = 0;
Timer timer;

timer = new Timer();
timer.Interval = 1000;
timer.Elapsed += new EventHandler(TimerEventProcessor);
timer.Start();

private void TimerEventProcessor(object sender, ElapsedEventArgs e)
{
  _counter += 1;
  if(counter == 1000)
      timer.Stop();
}
</code>```

Body:
I'm extremely new to c# and I'm wondering how I can make a basic timer that counts up by one using an integer. So far I only have

int timer = 0;
int max = 10000;

        while ( timer < max )
        {
          timer += 1;

        }

I'm assuming this will automatically boost the timer straight to 1000 because there's no speed set. I'm wondering how I can set a speed to this. Thank you.

Body:
You can try using C# Timer

int _counter = 0;
Timer timer;

timer = new Timer();
timer.Interval = 1000;
timer.Elapsed += new EventHandler(TimerEventProcessor);
timer.Start();

private void TimerEventProcessor(object sender, ElapsedEventArgs e)
{
  _counter += 1;
  if(counter == 1000)
      timer.Stop();
}


问:
Wavesurfer.js : How to display custom markers?
For my new webpage I need to integrate a wave formed audio player and I am using wavesurfer.js
 package. As they are saying about adding custom markers at different positions in wave form, I didn't get that working till now. My code is as below:

```<code>'use strict';

// Create an instance
var wavesurfer = Object.create(WaveSurfer);

// Init & load audio file
document.addEventListener('DOMContentLoaded', function () {
var options = {
    container     : document.querySelector('#waveform'),
    waveColor     : 'violet',
    progressColor : 'purple',
    loaderColor   : 'purple',
    cursorColor   : 'navy'
};

if (location.search.match('scroll')) {
    options.minPxPerSec = 100;
    options.scrollParent = true;
}

if (location.search.match('normalize')) {
    options.normalize = true;
}

// Init
wavesurfer.init(options);
// Load audio from URL
wavesurfer.load('example/media/demo.wav');

// Regions
if (wavesurfer.enableDragSelection) {
    wavesurfer.enableDragSelection({
        color: 'rgba(0, 255, 0, 0.1)'
    });
}
});

// Play at once when ready
wavesurfer.on('ready', function () {
wavesurfer.play();
wavesurfer.mark({id: 'chorus', position: 10})
});
</code>```

And getting an error as below in console:

```<code>Uncaught TypeError: undefined is not a function
</code>```

Can anybody suggest a solution for this ?

答:
You can get this working by calling on ready after the initialization of audio </p>

```<code>wavesurfer.on('ready', function () {

                    // Adding a couple of pre-defined regions
                    wavesurfer.addRegion({
                        start: 5, // time in seconds
                        end: 8, // time in seconds
                        color: 'hsla(100, 100%, 30%, 0.1)'
                    });
</code>```

Body:
For my new webpage I need to integrate a wave formed audio player and I am using wavesurfer.js
 package. As they are saying about adding custom markers at different positions in wave form, I didn't get that working till now. My code is as below:

'use strict';

// Create an instance
var wavesurfer = Object.create(WaveSurfer);

// Init & load audio file
document.addEventListener('DOMContentLoaded', function () {
var options = {
    container     : document.querySelector('#waveform'),
    waveColor     : 'violet',
    progressColor : 'purple',
    loaderColor   : 'purple',
    cursorColor   : 'navy'
};

if (location.search.match('scroll')) {
    options.minPxPerSec = 100;
    options.scrollParent = true;
}

if (location.search.match('normalize')) {
    options.normalize = true;
}

// Init
wavesurfer.init(options);
// Load audio from URL
wavesurfer.load('example/media/demo.wav');

// Regions
if (wavesurfer.enableDragSelection) {
    wavesurfer.enableDragSelection({
        color: 'rgba(0, 255, 0, 0.1)'
    });
}
});

// Play at once when ready
wavesurfer.on('ready', function () {
wavesurfer.play();
wavesurfer.mark({id: 'chorus', position: 10})
});

And getting an error as below in console:

Uncaught TypeError: undefined is not a function

Can anybody suggest a solution for this ?

Body:
You can get this working by calling on ready after the initialization of audio

wavesurfer.on('ready', function () {

                    // Adding a couple of pre-defined regions
                    wavesurfer.addRegion({
                        start: 5, // time in seconds
                        end: 8, // time in seconds
                        color: 'hsla(100, 100%, 30%, 0.1)'
                    });


问:
Splitting a string from a potential splitter
It's relatively a common requirement to split a string from a potential splitter:

```<code>$name = 'John'; // or can be 'John Smith'
</code>```

I use

```<code>list($firstName, $lastName) = explode(' ', $name) + [1 => null];
</code>```

or

```<code>@list($firstName, $lastName) = explode(' ', $name);
</code>```

I wonder if you guys use a more concise or more legible method for this?

答:
Oh, I found it!

```<code>list($firstName, $lastName) = explode(' ', $name.' ');
</code>```

The simple trick is appending the glue string to the end of the main string. Tadda!

This make accessing to the second part of the string really easy:

```<code>$domain = explode('@', $filter->email . '@')[1]; // for an invalid input the domain will be ''.
</code>```

Body:
It's relatively a common requirement to split a string from a potential splitter:

$name = 'John'; // or can be 'John Smith'

I use

list($firstName, $lastName) = explode(' ', $name) + [1 => null];

or

@list($firstName, $lastName) = explode(' ', $name);

I wonder if you guys use a more concise or more legible method for this?

Body:
Oh, I found it!

list($firstName, $lastName) = explode(' ', $name.' ');

The simple trick is appending the glue string to the end of the main string. Tadda!

This make accessing to the second part of the string really easy:

$domain = explode('@', $filter->email . '@')[1]; // for an invalid input the domain will be ''.


问:
Create array of unique objects by property
I created an array of objects like so:

[
    {
        "lat": 12.123,
        "lng": 13.213,
        "city": "New York"
    },
    {
        "lat": 3.123,
        "lng": 2.213,
        "city": "New York"
    },
    {
        "lat": 1.513,
        "lng": 1.113,
        "city": "London"
    }
]
```

I'm trying to create a new array that filters the places to only contains objects that don't have the same city property (lat/lng duplicates are ok). Is there a built in JS or Jquery function to achieve this?

答:
I expanded a bit on @IgorL solution, but extended prototype and gave it a selector function instead of a property to make it a little more flexible:

```<code>Array.prototype.unique = function(selector) {
   return this.filter((e, i) => this.findIndex((a) => {
      if (selector) {
        return selector(a) === selector(e);
      }
      return a === e;
    }) === i);
};
</code>```

Usage:

```<code>// with no param it uses strict equals (===) against the object
let primArr = ['one','one','two','three','one']
primArr.unique() // ['one','two','three']

let a = {foo:123}
let b = {foo:123}
let fooArr = [a,a,b]
fooArr.unique() //[a,b]

// alternatively, you can pass a selector function
fooArr.unique(item=>item.foo) //[{foo:123}] (first "unique" item returned)
</code>```

Definitely NOT the most performant way to do this but as long as the selector is simple and the array isn't massive, it should work fine.

In Typescript

```<code>Array.prototype.unique = function<T>(this: T[], selector?: (item: T) => object): T[] {
   return this.filter((e, i) => this.findIndex((a) => {
      if (selector) {
        return selector(a) === selector(e);
      }
      return a === e;
    }) === i);
};
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I created an array of objects like so:

[
    {
        "lat": 12.123,
        "lng": 13.213,
        "city": "New York"
    },
    {
        "lat": 3.123,
        "lng": 2.213,
        "city": "New York"
    },
    {
        "lat": 1.513,
        "lng": 1.113,
        "city": "London"
    }
]

I'm trying to create a new array that filters the places to only contains objects that don't have the same city property (lat/lng duplicates are ok). Is there a built in JS or Jquery function to achieve this?

Body:
I expanded a bit on @IgorL solution, but extended prototype and gave it a selector function instead of a property to make it a little more flexible:

Array.prototype.unique = function(selector) {
   return this.filter((e, i) => this.findIndex((a) => {
      if (selector) {
        return selector(a) === selector(e);
      }
      return a === e;
    }) === i);
};

Usage:

// with no param it uses strict equals (===) against the object
let primArr = ['one','one','two','three','one']
primArr.unique() // ['one','two','three']

let a = {foo:123}
let b = {foo:123}
let fooArr = [a,a,b]
fooArr.unique() //[a,b]

// alternatively, you can pass a selector function
fooArr.unique(item=>item.foo) //[{foo:123}] (first "unique" item returned)

Definitely NOT the most performant way to do this but as long as the selector is simple and the array isn't massive, it should work fine.

In Typescript

Array.prototype.unique = function<T>(this: T[], selector?: (item: T) => object): T[] {
   return this.filter((e, i) => this.findIndex((a) => {
      if (selector) {
        return selector(a) === selector(e);
      }
      return a === e;
    }) === i);
};


问:
Why Cubes falls through the floor but Player sphere dose not?
Start passing first tutorial "Roll-a-Ball", and at the stage #3 "Collecting, Scoring and Building the game", I saw an interesting thing without explanation:

Both "Player" and "Pick Up" have "Rigid Body component attached" and have Use Gravity checkbox selected.
But "Player" sphere dose not falls thought "Ground" mesh, but "Pick Up" cubes dose.

Why it happens?

here is moment in video:
https://youtu.be/XtR29MmzuT0?t=14m35s

答: The BoxCollider on the pick up prefab is marked as a trigger (i.e. IsTrigger is set to true). A trigger collider behaves as a volume or space in the world, unlike regular colliders which represent an actual physical entity. A trigger collider does not interact with the world, but raises events when a Rigidbody enters/exits/stays in the volume in the world represented by it.


问:
percentage on y lab in a faceted ggplot barchart?
doing facets in ggplot I would often like the percentage to be used instead of counts.

e.g.

```<code>test1 <- sample(letters[1:2], 100, replace=T)
test2 <- sample(letters[3:8], 100, replace=T)
test <- data.frame(cbind(test1,test2))
ggplot(test, aes(test2))+geom_bar()+facet_grid(~test1)
</code>```

This is very easy but if N is different in facet A compared to facet B, it would be better I think, to compare percentages, in such a way that the each facet sums to 100%.

how would you achieve this?

Hope my question makes sense.

Sincerely.

答:
Here's a solution that should get you moving in the right direction. I'm curious to see if there are more efficient ways to go about doing this as this seems a bit hacky and convoluted. We can use the built in ..density.. argument for the y aesthetic, but factors don't work there. So we also need to use scale_x_discrete to appropriately label the axis once we converted test2 into a numeric object.

```<code>ggplot(data = test, aes(x = as.numeric(test2)))+
geom_bar(aes(y = ..density..), binwidth = .5)+
scale_x_discrete(limits = sort(unique(test$test2))) +
facet_grid(~test1) + xlab("Test 2") + ylab("Density")
</code>```

But give this a whirl and let me know what you think.

Also, you can shorten your test data creation like so, which avoids the extra objects in your environment and having to cbind them together:

```<code>test <- data.frame(
    test1 = sample(letters[1:2], 100, replace = TRUE),
    test2 = sample(letters[3:8], 100, replace = TRUE)
)
</code>```

ContentLicense: CC BY-SA 2.5

Body:
doing facets in ggplot I would often like the percentage to be used instead of counts.

e.g.

test1 <- sample(letters[1:2], 100, replace=T)
test2 <- sample(letters[3:8], 100, replace=T)
test <- data.frame(cbind(test1,test2))
ggplot(test, aes(test2))+geom_bar()+facet_grid(~test1)

This is very easy but if N is different in facet A compared to facet B, it would be better I think, to compare percentages, in such a way that the each facet sums to 100%.

how would you achieve this?

Hope my question makes sense.

Sincerely.

Body:
Here's a solution that should get you moving in the right direction. I'm curious to see if there are more efficient ways to go about doing this as this seems a bit hacky and convoluted. We can use the built in ..density.. argument for the y aesthetic, but factors don't work there. So we also need to use scale_x_discrete to appropriately label the axis once we converted test2 into a numeric object.

ggplot(data = test, aes(x = as.numeric(test2)))+
geom_bar(aes(y = ..density..), binwidth = .5)+
scale_x_discrete(limits = sort(unique(test$test2))) +
facet_grid(~test1) + xlab("Test 2") + ylab("Density")

But give this a whirl and let me know what you think.

Also, you can shorten your test data creation like so, which avoids the extra objects in your environment and having to cbind them together:

test <- data.frame(
    test1 = sample(letters[1:2], 100, replace = TRUE),
    test2 = sample(letters[3:8], 100, replace = TRUE)
)


问:
How to read value in combobox when editing data with codeigniter
I can't show the data that I want to edit from my table. The combobox and the table don't show data when I edit the data categories, sub-categories, and manufacturers. I want to be able to see the data from my table after editing.

Controller form

```<code>public function data_items_edit($id)
    {

    $this->load->model('additem_m');
    $model3 = $this->additem_m;
    $data['table'] = $model3->get_where2($id)[0];
    //$data['table'] = $model3->get();
    $this->load->model('category_m');
    $model = $this->category_m;
    $data['category'] = $model->get();

    $this->load->model('subcategory_m');
    $model1 = $this->subcategory_m;
    $data['sub'] = $model1->get();

    $this->load->model('manufactures_m');
    $model2 = $this->manufactures_m;
    $data['manu'] = $model2->get();

    //print_r($data['table']);
    $this->load->view('items/edit_items_v', $data);
}
</code>```

Data table controller

```<code>public function index()
{
    if($this->session->has_userdata('isLogin')){
    $this->load->model('additem_m');
    $model = $this->additem_m;
    $data['table'] = $model->get('items.*, item_categories.name as ic,
    item_categories_sub.name as ics, item_manufactures.name as im',
    [
        ['table'=>'item_categories','condition'=>'item_categories.id =
        items.item_category_id'],
        ['table'=>'item_categories_sub','condition'=>'item_categories_sub.id
         = items.item_category_sub_id'],
        ['table'=>'item_manufactures','condition'=>'item_manufactures.id =
        items.item_manufacturer_id'],
        ]);
        //print_r($data['table']);
        $this->load->view('items/items_v', $data);
        }else{
        redirect('login');
    }
}
</code>```

View Form

```<code><div class="form-group">
    <label class="col-sm-4 control-label form-label">Category :</label>
    <div class="col-sm-8">
        <select name="item_category_id" class="form-control" id="category">
            <option  value='' <?php if($category == '0'){ echo 'selected';} ?>>--Select--</option>
            <?php foreach($category as $category){
                echo '<option value="'.$category->id.'">'.$category->name.'</option>';
            } ?>
        </select>
    </div>
</div>
<div class="form-group">
    <label class="col-sm-4 control-label form-label">Sub Category</label>
    <div class="col-sm-8">
        <select name="item_category_sub_id" class="form-control" id="category_sub">
            <option value=''>- Select Sub Category -</option>
        </select>
    </div>
</div>
<div class="rightcontact">
    <div class="form-group">
        <label class="col-sm-4 control-label form-label">Manufacturer</label>
        <div class="col-sm-8">
            <select name="item_manufacturer_id" class="form-control" id="item_manufacturer_id">
                <option>- Select Manufacturer -</option>
                <?php foreach($manu as $manu){
                    echo '<option value="'.$manu->id.'">'.$manu->name."</option>";
                } ?>
            </select>
        </div>
    </div>
</div>
</code>```

My view

答:
You have to add selected attribute to the options.

```<code>$category == $category->id ? "selected" : ""
</code>```

Something like this

```<code><?php
    foreach($category as $category){
        echo '<option value="'.$category->id.'" '. $category == $category->id ? "selected" : "" .'>'.$category->name.'</option>';
                                                  ^                                            ^
    }
?>
</code>```

Body:
I can't show the data that I want to edit from my table. The combobox and the table don't show data when I edit the data categories, sub-categories, and manufacturers. I want to be able to see the data from my table after editing.

Controller form

public function data_items_edit($id)
    {

    $this->load->model('additem_m');
    $model3 = $this->additem_m;
    $data['table'] = $model3->get_where2($id)[0];
    //$data['table'] = $model3->get();
    $this->load->model('category_m');
    $model = $this->category_m;
    $data['category'] = $model->get();

    $this->load->model('subcategory_m');
    $model1 = $this->subcategory_m;
    $data['sub'] = $model1->get();

    $this->load->model('manufactures_m');
    $model2 = $this->manufactures_m;
    $data['manu'] = $model2->get();

    //print_r($data['table']);
    $this->load->view('items/edit_items_v', $data);
}

Data table controller

public function index()
{
    if($this->session->has_userdata('isLogin')){
    $this->load->model('additem_m');
    $model = $this->additem_m;
    $data['table'] = $model->get('items.*, item_categories.name as ic,
    item_categories_sub.name as ics, item_manufactures.name as im',
    [
        ['table'=>'item_categories','condition'=>'item_categories.id =
        items.item_category_id'],
        ['table'=>'item_categories_sub','condition'=>'item_categories_sub.id
         = items.item_category_sub_id'],
        ['table'=>'item_manufactures','condition'=>'item_manufactures.id =
        items.item_manufacturer_id'],
        ]);
        //print_r($data['table']);
        $this->load->view('items/items_v', $data);
        }else{
        redirect('login');
    }
}

View Form

    Category :

        <select name="item_category_id" class="form-control" id="category">
            <option  value='' <?php if($category == '0'){ echo 'selected';} ?>>--Select--</option>
            <?php foreach($category as $category){
                echo '<option value="'.$category->id.'">'.$category->name.'</option>';
            } ?>
        </select>

    Sub Category

        <select name="item_category_sub_id" class="form-control" id="category_sub">
            <option value=''>- Select Sub Category -</option>
        </select>

        Manufacturer

            <select name="item_manufacturer_id" class="form-control" id="item_manufacturer_id">
                <option>- Select Manufacturer -</option>
                <?php foreach($manu as $manu){
                    echo '<option value="'.$manu->id.'">'.$manu->name."</option>";
                } ?>
            </select>

My view

Body:
You have to add selected attribute to the options.

$category == $category->id ? "selected" : ""

Something like this

<?php
    foreach($category as $category){
        echo '<option value="'.$category->id.'" '. $category == $category->id ? "selected" : "" .'>'.$category->name.'</option>';
                                                  ^                                            ^
    }
?>


问:
white line appearing between 2 div's
I am trying to get rid of a thin white line that appears between the 1st 2 Div's of my website ("video_main" and "parallax").  I thought this might be an artifact of the video so I cropped the bottom in export from Premiere Pro CC but it still appears.  I tried making a margin, padding and border 0px for the video_main and parallax div's but it doesn't get rid of the thin white line.  Can anyone tell why it's happening?  Many thanks.

<!DOCTYPE HTML>

  <meta charset="UTF-8">
  <title>Barton's website</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <video width="100%" height="100%" autoplay="autoplay" loop="loop" muted="muted" preload>
    <source src="red_hook_rush_hour_trimmed.mp4" type="video/mp4">
        </video>

Barton Lewis

films about light and the urban landscape

home

works

bio

CV

contact

text

text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here.

```

<pre class="lang-css prettyprint-override"><code>/* http://meyerweb.com/eric/tools/css/reset/
       v2.0 | 20110126
       License: none (public domain)
    */

* {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
paragraph {
  display: block;
}

body {
  line-height: 1;
}

ol,
ul {
  list-style: none;
}

blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/*THIS IS THE END OF THE MYER RESET*/

body {
  width: 100%;
  margin: 0 auto 0;
}

a {
  font-family: "europa", sans-serif;
  text-align: left;
  text-decoration: none;
  letter-spacing: 3px;
  font-size: 22px;
  color: white;
}

a:hover {
  text-decoration: underline;
}

.parallax {
  /* The image used */
  background-image: url("https://bartonlewisfilm.com/html_bckgd_1024.jpg");
  /* Set a specific height */
  height: 1620px;
  /* Create the parallax scrolling effect */
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.video_main {
  margin: 0 auto 0;
  width: 100%;
  height: auto;
  overflow: hidden;
}

.video_main video {
  /*width: 100%;*/
  width: 100%;
  height: auto;
  min-width: 720px;
  margin: 0 auto;
  z-index: -1500;
}

.content h1 {
  font-family: "jaf-domus-titling-web", sans-serif;
  color: white;
  text-align: center;
  font-size: 400%;
  letter-spacing: 4px;
  z-index: 100;
  position: absolute;
  top: 50px;
}

.content h2 {
  font-family: "europa", sans-serif;
  color: white;
  text-align: center;
  font-size: 225%;
  letter-spacing: 6px;
  z-index: 100;
  position: absolute;
  top: 175px;
}

.content p {
  font-family: "europa", sans-serif;
  color: white;
  font-size: 120%;
}

h1 {
  width: 100%;
}

h2 {
  width: 100%;
}

.content .videolinks {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 100;
}

.videolinks p {
  padding: 20px;
  padding-left: 60px;
}

.videolinks p:first-child {
  padding-top: 250px;
}

.wrapper_pano_and_text {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  width: 100%;
  padding-top: 0px;
  justify-content: center;
  align-items: center;
}

.pano img {
  width: 100%;
  height: 100%;
  padding: ;
  z-index: -1500;
}

.pano_text {
  width: 45%;
  overflow: hidden;
  z-index: 100;
  position: absolute;
}

.pano_text p {
  font-family: "europa", sans-serif;
  font-size: 150%;
  padding-right: 80px;
  letter-spacing: px;
  color: white;
  font-weight: 500;
  line-height: 135%;
  font-weight: 500;
}

.container_blank_space {
  height: 75px;
}

.container_blank_space p {
  text-indent: -9999px;
}
</code>```

答:
Looks like your video element under .video_main is missing a value for display different from inline.

You should set its value for display (CSS) to display: block or display: flex so the parent container can adapt its height properly.

Working  Codepen example. Take a look at the declaration of .video_main video.

Title: white line appearing between 2 div's

Body:
I am trying to get rid of a thin white line that appears between the 1st 2 Div's of my website ("video_main" and "parallax").  I thought this might be an artifact of the video so I cropped the bottom in export from Premiere Pro CC but it still appears.  I tried making a margin, padding and border 0px for the video_main and parallax div's but it doesn't get rid of the thin white line.  Can anyone tell why it's happening?  Many thanks.

<!DOCTYPE HTML>

  <meta charset="UTF-8">
  <title>Barton's website</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <video width="100%" height="100%" autoplay="autoplay" loop="loop" muted="muted" preload>
    <source src="red_hook_rush_hour_trimmed.mp4" type="video/mp4">
        </video>

Barton Lewis

films about light and the urban landscape

home

works

bio

CV

contact

text

text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here text goes here.

/* http://meyerweb.com/eric/tools/css/reset/
       v2.0 | 20110126
       License: none (public domain)
    */

* {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
paragraph {
  display: block;
}

body {
  line-height: 1;
}

ol,
ul {
  list-style: none;
}

blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/*THIS IS THE END OF THE MYER RESET*/

body {
  width: 100%;
  margin: 0 auto 0;
}

a {
  font-family: "europa", sans-serif;
  text-align: left;
  text-decoration: none;
  letter-spacing: 3px;
  font-size: 22px;
  color: white;
}

a:hover {
  text-decoration: underline;
}

.parallax {
  /* The image used */
  background-image: url("https://bartonlewisfilm.com/html_bckgd_1024.jpg");
  /* Set a specific height */
  height: 1620px;
  /* Create the parallax scrolling effect */
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.video_main {
  margin: 0 auto 0;
  width: 100%;
  height: auto;
  overflow: hidden;
}

.video_main video {
  /*width: 100%;*/
  width: 100%;
  height: auto;
  min-width: 720px;
  margin: 0 auto;
  z-index: -1500;
}

.content h1 {
  font-family: "jaf-domus-titling-web", sans-serif;
  color: white;
  text-align: center;
  font-size: 400%;
  letter-spacing: 4px;
  z-index: 100;
  position: absolute;
  top: 50px;
}

.content h2 {
  font-family: "europa", sans-serif;
  color: white;
  text-align: center;
  font-size: 225%;
  letter-spacing: 6px;
  z-index: 100;
  position: absolute;
  top: 175px;
}

.content p {
  font-family: "europa", sans-serif;
  color: white;
  font-size: 120%;
}

h1 {
  width: 100%;
}

h2 {
  width: 100%;
}

.content .videolinks {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 100;
}

.videolinks p {
  padding: 20px;
  padding-left: 60px;
}

.videolinks p:first-child {
  padding-top: 250px;
}

.wrapper_pano_and_text {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  width: 100%;
  padding-top: 0px;
  justify-content: center;
  align-items: center;
}

.pano img {
  width: 100%;
  height: 100%;
  padding: ;
  z-index: -1500;
}

.pano_text {
  width: 45%;
  overflow: hidden;
  z-index: 100;
  position: absolute;
}

.pano_text p {
  font-family: "europa", sans-serif;
  font-size: 150%;
  padding-right: 80px;
  letter-spacing: px;
  color: white;
  font-weight: 500;
  line-height: 135%;
  font-weight: 500;
}

.container_blank_space {
  height: 75px;
}

.container_blank_space p {
  text-indent: -9999px;
}


问:
How to create a table in the database in Magento using install script
I am new to Magento.I am trying to create a table in the database using a install script.THE WEB SITE IS HOSTED.I followed few tutorials.They all look  same.I followed every step,but the table is not created .Can some one tell me where I have gone wrong?
These are the steps I follwed.
First I created the folder called Sitepoint inside app/code.Then I created a Articles folder inside Sitepont.This is how it looks

app/code/local/Sitepoint/Articles

Then I created etc folder inside the sitepoint

app/code/local/Sitepoint/Articles/etc

etc floder consist of config.xml file.It contains following code.

```<code><global>
    <models>
        <articles>
            <class>Sitepoint_Articles_Model</class> <!-- Model class files -->
            <resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
        </articles>
        <articles_mysql4>
            <class>Sitepoint_Articles_Model_Mysql4</class>
            <entities>
                <articles>
                    <table>articles</table>  <!-- Db table name  -->
                </articles>
            </entities>
        </articles_mysql4>
    </models>
    <resources>
        <articles_setup>
            <setup>
                <module>Sitepoint_Articles</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </articles_setup>
        <articles_write>
            <connection>
                <use>core_write</use>
            </connection>
        </articles_write>
        <articles_read>
            <connection>
                <use>core_read</use>
            </connection>
        </articles_read>
    </resources>
</global>
</code>```

Then I created folders for sql and articles_setup in the following way
app/code/local/Sitepoint/Articles/sql/articles_setup
Inside that it, contains mysql4-install-0.1.0.php file which has the following code.

```<code><?php
$installer = $this;
$installer->startSetup();
$installer->run("-- DROP TABLE IF EXISTS {$this->getTable('articles')};
CREATE TABLE {$this->getTable('articles')} (
      `articles_id` int(11) unsigned NOT NULL auto_increment,
      `title` varchar(255) NOT NULL default '',
      `short_desc` text NOT NULL default '',
      `long_desc` text NOT NULL default '',
      `status` tinyint(2) NOT NULL default '0',
      `created_time` datetime NULL,
      `update_time` datetime NULL,
      PRIMARY KEY (`articles_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    ");
    $installer->endSetup();
?>
</code>```

I followed this tutorial =>
https://www.sitepoint.com/magento-install-upgrade-data-scripts-explained/
But the tables are not created.I tried few other tutorials.They all provide the same way.Can someone help me?

答:
create Sitepoint_Articles.xml file in app/etc/modules folder and past the following code there. Clear cache and reload the website. Navigate to system->configuration-advanced->advance and make sure your module is listed there. If it appears, check if the table has been created.

app/etc/modules/Sitepoint_Articles.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Sitepoint_Articles>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <!-- add any depending modules here -->
            </depends>
        </Sitepoint_Articles>
    </modules>
</config>
</code>```

Body:
I am new to Magento.I am trying to create a table in the database using a install script.THE WEB SITE IS HOSTED.I followed few tutorials.They all look  same.I followed every step,but the table is not created .Can some one tell me where I have gone wrong?
These are the steps I follwed.
First I created the folder called Sitepoint inside app/code.Then I created a Articles folder inside Sitepont.This is how it looks

app/code/local/Sitepoint/Articles

Then I created etc folder inside the sitepoint

app/code/local/Sitepoint/Articles/etc

etc floder consist of config.xml file.It contains following code.

<global>
    <models>
        <articles>
            <class>Sitepoint_Articles_Model</class>
            <resourceModel>articles_mysql4</resourceModel>
        </articles>
        <articles_mysql4>
            <class>Sitepoint_Articles_Model_Mysql4</class>
            <entities>
                <articles>

articles

                </articles>
            </entities>
        </articles_mysql4>
    </models>
    <resources>
        <articles_setup>
            <setup>
                <module>Sitepoint_Articles</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </articles_setup>
        <articles_write>
            <connection>
                <use>core_write</use>
            </connection>
        </articles_write>
        <articles_read>
            <connection>
                <use>core_read</use>
            </connection>
        </articles_read>
    </resources>
</global>

Then I created folders for sql and articles_setup in the following way
app/code/local/Sitepoint/Articles/sql/articles_setup
Inside that it, contains mysql4-install-0.1.0.php file which has the following code.

<?php
$installer = $this;
$installer->startSetup();
$installer->run("-- DROP TABLE IF EXISTS {$this->getTable('articles')};
CREATE TABLE {$this->getTable('articles')} (
      `articles_id` int(11) unsigned NOT NULL auto_increment,
      `title` varchar(255) NOT NULL default '',
      `short_desc` text NOT NULL default '',
      `long_desc` text NOT NULL default '',
      `status` tinyint(2) NOT NULL default '0',
      `created_time` datetime NULL,
      `update_time` datetime NULL,
      PRIMARY KEY (`articles_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    ");
    $installer->endSetup();
?>

I followed this tutorial =>
https://www.sitepoint.com/magento-install-upgrade-data-scripts-explained/
But the tables are not created.I tried few other tutorials.They all provide the same way.Can someone help me?

Body:
create Sitepoint_Articles.xml file in app/etc/modules folder and past the following code there. Clear cache and reload the website. Navigate to system->configuration-advanced->advance and make sure your module is listed there. If it appears, check if the table has been created.

app/etc/modules/Sitepoint_Articles.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Sitepoint_Articles>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <!-- add any depending modules here -->
            </depends>
        </Sitepoint_Articles>
    </modules>
</config>


问:
Asp.net core razor pages load partial page
I use asp.net core 2 new feature Razor pages.  in the _layout.cshtml.

```<code> <body>
<div>
   @await Html.PartialAsync("_LayoutHeader")
    <div class="row">
        <div>
            <div class="row">
                @RenderBody()
            </div>
        </div>
    </div>
</code>```

the _layoutHeader.cshtml is page with code behind.

```<code>@page
@using Microsoft.AspNetCore.Identity
@model Yiko.Ent.WebRazorPages.Pages._LayoutHeaderModel
</code>```

and @RenderBody will load index.cshtml with pagemodel.

```<code>@page
@model Yiko.Ent.WebRazorPages.Pages.Home.IndexModel
@{
    ViewData["Title"] = "Home";
}
</code>```

run the project. throw a error:

InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'Yiko.Ent.WebRazorPages.Pages.Home.IndexModel', but this ViewDataDictionary instance requires a model item of type 'Yiko.Ent.WebRazorPages.Pages._LayoutHeaderModel'.
  Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary.EnsureCompatible(object value)

答:
You can redirect to the page, or you can make the core view code into a partial and call it from both.

Pages are not a replacement for partials or View Components.

Body:
I use asp.net core 2 new feature Razor pages.  in the _layout.cshtml.

   @await Html.PartialAsync("_LayoutHeader")

                @RenderBody()

the _layoutHeader.cshtml is page with code behind.

@page
@using Microsoft.AspNetCore.Identity
@model Yiko.Ent.WebRazorPages.Pages._LayoutHeaderModel

and @RenderBody will load index.cshtml with pagemodel.

@page
@model Yiko.Ent.WebRazorPages.Pages.Home.IndexModel
@{
    ViewData["Title"] = "Home";
}

run the project. throw a error:

InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'Yiko.Ent.WebRazorPages.Pages.Home.IndexModel', but this ViewDataDictionary instance requires a model item of type 'Yiko.Ent.WebRazorPages.Pages._LayoutHeaderModel'.
  Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary.EnsureCompatible(object value)


问:
How to set the value of the input name "PickupDate" using VBA?
I have tried the following code but obtain an Object error:</p>

```<code>Dim g As IHTMLElement

Set g = appIE.getElementsByName("PickupDate")
    g.Value = b

<div class="date date-time-field" id="pickup-date">
    <div class="date-icon icon"></div>
    <input name="PickupDate" class="short picker__input" id="P666421526" aria-expanded="false" aria-haspopup="true" aria-readonly="false" aria-owns="P666421526_root" type="text" readonly="" placeholder="Date">
                                    </div>
</code>```

答:
Give this a shot:

For a particular value:

```<code>Set post = html.getElementsByName("PickupDate")
MsgBox post(0).ID
</code>```

Looping through multiple values:

```<code>For Each post In html.getElementsByName("PickupDate")
    MsgBox post.ID
Next post
</code>```

Body:
I have tried the following code but obtain an Object error:

Dim g As IHTMLElement

Set g = appIE.getElementsByName("PickupDate")
    g.Value = b

    <input name="PickupDate" class="short picker__input" id="P666421526" aria-expanded="false" aria-haspopup="true" aria-readonly="false" aria-owns="P666421526_root" type="text" readonly="" placeholder="Date">

Body:
Give this a shot:

For a particular value:

Set post = html.getElementsByName("PickupDate")
MsgBox post(0).ID

Looping through multiple values:

For Each post In html.getElementsByName("PickupDate")
    MsgBox post.ID
Next post


问:
Facebook Account Kit Collision with Google play services gradle
After configuring account kit sdk as

```<code>  compile 'com.facebook.android:account-kit-sdk:4.+'
</code>```

and gradle sync it conflict with com.google.android.gms gradle as mixing versions can lead to runtime crashes and my app crash as

Firebase API initialization failure.
                                                  java.lang.reflect.InvocationTargetException
                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                      at com.google.firebase.FirebaseApp.zza(Unknown Source)
                                                      at ...

the above error is due to mixing google play services gradle (I think Google play services gradle may be used by Facebook Account Kit SDK) because I have same version for all Google play services gradles.

And one more crash is coming from Facebook Account Kit SDK side as

```<code> java.lang.RuntimeException: Unable to get provider com.facebook.accountkit.internal.AccountKitInitProvider: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
                                                       at android.app.ActivityThread.installProvider(ActivityThread.java:5260)
                                                       at android.app.ActivityThread.installContentProviders(ActivityThread.java:4808)
                                                       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4748)
                                                       at android.app.ActivityThread.access$1700(ActivityThread.java:153)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1436)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:154)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5529)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
                                                    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
                                                       at com.facebook.accountkit.internal.Initializer.initialize(Initializer.java:99)
                                                       at com.facebook.accountkit.internal.AccountKitController.initialize(AccountKitController.java:592)
                                                       at com.facebook.accountkit.internal.AccountKitInitProvider.onCreate(AccountKitInitProvider.java:31)
                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1758)
                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1733)
                                                       at android.app.ActivityThread.installProvider(ActivityThread.java:5257)
                                                       at android.app.ActivityThread.installContentProviders(ActivityThread.java:4808)
                                                       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4748)
                                                       at android.app.ActivityThread.access$1700(ActivityThread.java:153)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1436)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:154)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5529)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
</code>```

But after removing

```<code>  compile 'com.facebook.android:account-kit-sdk:4.+'
</code>```

my app working without any issue.
But to integrate Facebook Account Kit in my app I have to include above gradle which conflict with google play services.

Totally disappointed, please help.

After upgrading Firebase Gradle as

```<code>compile 'com.google.firebase:firebase-messaging:11.6.0'
</code>```

its not colliding but still gives above RuntimeException from Account Kit SDK.

答:
For Unable to get provider RuntimeException exception it seems that, Application is not initialized first, Content Providers are initialized before it.
And in Facebook account kit SDK's code it was trying to get my application context.

Now the problem was, I did implement method getApplicationContext() in application class that is getting application shared variable but that variable was setting globally and Facebook Account Kit sdk code getting Null application context.

Solution : setting shared variable in onCreate method instead of setting globally it resolved the problem of Unable to get provider.

And For Mixing issue, Account Kit SDK use 11.0.1 version for play services gradle and in my project I am having 11.0.4 that is actually not the issue because on compile time gradle takes latest gradle but In my project I am not referring below gradle which Facebook Account Kit SDK is using.

```<code>compile 'com.google.android.gms:play-services-auth-api-phone:11.0.1'
</code>```

Solution : I have added above gradle with version 11.0.4 and the mixing gradle issue has been resolved.

```<code>compile 'com.google.android.gms:play-services-auth-api-phone:11.0.4'
</code>```

And as suggested by @astryk if I exclude play-services-auth-api-phone module then  gradle mixing error is not showing but it is not including that module becasue in AccountKitActivity on next button click my application crashes as

```<code>Crash Report Thread:main Exception:java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/auth/api/phone/SmsRetriever;
at com.facebook.accountkit.internal.PhoneLoginController.createSmsToken(PhoneLoginController.java:250)
at com.facebook.accountkit.internal.PhoneLoginController.logIn(PhoneLoginController.java:188)
at com.facebook.accountkit.internal.LoginManager.logInWithPhoneNumber(LoginManager.java:372)
at com.facebook.accountkit.internal.AccountKitController.logInWithPhoneNumber(AccountKitController.java:631)
at com.facebook.accountkit.ui.PhoneLoginFlowManager.logInWithPhoneNumber(PhoneLoginFlowManager.java:57)
at com.facebook.accountkit.ui.ActivityPhoneHandler.onPhoneLoginComplete(ActivityPhoneHandler.java:189)
at com.facebook.accountkit.ui.AccountKitActivity$1.onReceive(AccountKitActivity.java:176)
at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
at android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46)
at android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.phone.SmsRetriever" on path: DexPathList[[zip file "/data/app/com.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myappList item -1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 16 more
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.auth.api.phone.SmsRetriever
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available`
</code>```

Body:
After configuring account kit sdk as

  compile 'com.facebook.android:account-kit-sdk:4.+'

and gradle sync it conflict with com.google.android.gms gradle as mixing versions can lead to runtime crashes and my app crash as

Firebase API initialization failure.
                                                  java.lang.reflect.InvocationTargetException
                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                      at com.google.firebase.FirebaseApp.zza(Unknown Source)
                                                      at ...

the above error is due to mixing google play services gradle (I think Google play services gradle may be used by Facebook Account Kit SDK) because I have same version for all Google play services gradles.

And one more crash is coming from Facebook Account Kit SDK side as

 java.lang.RuntimeException: Unable to get provider com.facebook.accountkit.internal.AccountKitInitProvider: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
                                                       at android.app.ActivityThread.installProvider(ActivityThread.java:5260)
                                                       at android.app.ActivityThread.installContentProviders(ActivityThread.java:4808)
                                                       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4748)
                                                       at android.app.ActivityThread.access$1700(ActivityThread.java:153)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1436)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:154)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5529)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
                                                    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
                                                       at com.facebook.accountkit.internal.Initializer.initialize(Initializer.java:99)
                                                       at com.facebook.accountkit.internal.AccountKitController.initialize(AccountKitController.java:592)
                                                       at com.facebook.accountkit.internal.AccountKitInitProvider.onCreate(AccountKitInitProvider.java:31)
                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1758)
                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1733)
                                                       at android.app.ActivityThread.installProvider(ActivityThread.java:5257)
                                                       at android.app.ActivityThread.installContentProviders(ActivityThread.java:4808)
                                                       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4748)
                                                       at android.app.ActivityThread.access$1700(ActivityThread.java:153)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1436)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:154)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5529)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)

But after removing

  compile 'com.facebook.android:account-kit-sdk:4.+'

my app working without any issue.
But to integrate Facebook Account Kit in my app I have to include above gradle which conflict with google play services.

Totally disappointed, please help.

After upgrading Firebase Gradle as

compile 'com.google.firebase:firebase-messaging:11.6.0'

its not colliding but still gives above RuntimeException from Account Kit SDK.

Body:
For Unable to get provider RuntimeException exception it seems that, Application is not initialized first, Content Providers are initialized before it.
And in Facebook account kit SDK's code it was trying to get my application context.

Now the problem was, I did implement method getApplicationContext() in application class that is getting application shared variable but that variable was setting globally and Facebook Account Kit sdk code getting Null application context.

Solution : setting shared variable in onCreate method instead of setting globally it resolved the problem of Unable to get provider.

And For Mixing issue, Account Kit SDK use 11.0.1 version for play services gradle and in my project I am having 11.0.4 that is actually not the issue because on compile time gradle takes latest gradle but In my project I am not referring below gradle which Facebook Account Kit SDK is using.

compile 'com.google.android.gms:play-services-auth-api-phone:11.0.1'

Solution : I have added above gradle with version 11.0.4 and the mixing gradle issue has been resolved.

compile 'com.google.android.gms:play-services-auth-api-phone:11.0.4'

And as suggested by @astryk if I exclude play-services-auth-api-phone module then  gradle mixing error is not showing but it is not including that module becasue in AccountKitActivity on next button click my application crashes as

Crash Report Thread:main Exception:java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/auth/api/phone/SmsRetriever;
at com.facebook.accountkit.internal.PhoneLoginController.createSmsToken(PhoneLoginController.java:250)
at com.facebook.accountkit.internal.PhoneLoginController.logIn(PhoneLoginController.java:188)
at com.facebook.accountkit.internal.LoginManager.logInWithPhoneNumber(LoginManager.java:372)
at com.facebook.accountkit.internal.AccountKitController.logInWithPhoneNumber(AccountKitController.java:631)
at com.facebook.accountkit.ui.PhoneLoginFlowManager.logInWithPhoneNumber(PhoneLoginFlowManager.java:57)
at com.facebook.accountkit.ui.ActivityPhoneHandler.onPhoneLoginComplete(ActivityPhoneHandler.java:189)
at com.facebook.accountkit.ui.AccountKitActivity$1.onReceive(AccountKitActivity.java:176)
at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
at android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46)
at android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.phone.SmsRetriever" on path: DexPathList[[zip file "/data/app/com.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myappList item -1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 16 more
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.auth.api.phone.SmsRetriever
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available`


问:
Xamarin.Android Alternative Colors List
I want to make the rows in my ListView in alternative colors - Xamarin.Android C# Project.

Here's my code

```<code>ListView DialogoList = (ListView)FindViewById(Resource.Id.DialogoList);
Data data = new Data();
string[] dialogolist = data.Dialogo(Data.level, Data.Lesson);
DialogoList.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, dialogolist);
</code>```

答:
As @Nongthonbam Tonthoi said, you could override the GetView color depending on position :

For example :

```<code>public override View GetView(int position, View convertView, ViewGroup parent)
{
    var item = items[position];
    View view = convertView;
    if (view == null) // no view to re-use, create new
        view = context.LayoutInflater.Inflate(Resource.Layout.CustomView, null);

    view.FindViewById<TextView>(Resource.Id.Text1).Text = item.Heading;
    view.FindViewById<TextView>(Resource.Id.Text2).Text = item.SubHeading;
    view.FindViewById<ImageView>(Resource.Id.Image).SetImageResource(item.ImageResourceId);

    if (position % 2 == 0)
    {
        view.FindViewById<RelativeLayout>(Resource.Id.listView_item_bg).SetBackgroundColor(Color.Pink);
    }
    else
    {
        view.FindViewById<RelativeLayout>(Resource.Id.listView_item_bg).SetBackgroundColor(Color.Blue);
    }
    return view;
}
</code>```

For complete code you could refer to this sample.

Effect.

Title: Xamarin.Android Alternative Colors List

Body:
I want to make the rows in my ListView in alternative colors - Xamarin.Android C# Project.

Here's my code

ListView DialogoList = (ListView)FindViewById(Resource.Id.DialogoList);
Data data = new Data();
string[] dialogolist = data.Dialogo(Data.level, Data.Lesson);
DialogoList.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, dialogolist);

Body:
As @Nongthonbam Tonthoi said, you could override the GetView color depending on position :

For example :

public override View GetView(int position, View convertView, ViewGroup parent)
{
    var item = items[position];
    View view = convertView;
    if (view == null) // no view to re-use, create new
        view = context.LayoutInflater.Inflate(Resource.Layout.CustomView, null);

    view.FindViewById<TextView>(Resource.Id.Text1).Text = item.Heading;
    view.FindViewById<TextView>(Resource.Id.Text2).Text = item.SubHeading;
    view.FindViewById<ImageView>(Resource.Id.Image).SetImageResource(item.ImageResourceId);

    if (position % 2 == 0)
    {
        view.FindViewById<RelativeLayout>(Resource.Id.listView_item_bg).SetBackgroundColor(Color.Pink);
    }
    else
    {
        view.FindViewById<RelativeLayout>(Resource.Id.listView_item_bg).SetBackgroundColor(Color.Blue);
    }
    return view;
}

For complete code you could refer to this sample.

Effect.


问:
Difference between baseline and benchmark when performance testing REST endpoint?
What is the Difference between baseline and benchmark when performance testing REST endpoint?
Let say I have SLA's given upfront and I am trying to test endpoints for what load that it can live with withing my SLA's.  What do I call those metrics?</p>

答:
I would explain it as follows:

Baseline - when you put your system under anticipated load to see whether your application is capable of handling the expected amount of users. The approach is better known as Load Testing so I think you can find a way more information on "load testing" rather than on "baseline testing"

Benchmark - when you are trying to determine your application boundaries, i.e. determine how many users it theoretically can handle before it breaks or response time/throughput exceeds what is defined in the SLA (whatever comes the first). You can refer this as Stress Testing if you need more information.

See Performance Testing vs. Load Testing vs. Stress Testing article for more detailed explanation of the approaches


问:
Can we fetch a table models from MySql using Nodejs ORM2 without defining all the properties/fields?
I would like to know if we can fetch a table model from MySql from Database, without defining all the properties.
I'm using Node.js ORM2

```<code>const orm = require('orm');
db.define('users', {
    // donot want to specify all the properties/fields
  });
</code>```

Above users table has already been created in DB, so I just want to get that model and not create/specify all the properties in it.
We can do this with other ORM's like Objection.js - but can't change my current implementation.

Thanks in advance,

答: Unfortunately, you must define properties/fields while you are defining your Models.  There aren't any other options.</p>

Body:
I would like to know if we can fetch a table model from MySql from Database, without defining all the properties.
I'm using Node.js ORM2

const orm = require('orm');
db.define('users', {
    // donot want to specify all the properties/fields
  });

Above users table has already been created in DB, so I just want to get that model and not create/specify all the properties in it.
We can do this with other ORM's like Objection.js - but can't change my current implementation.

Thanks in advance,