C # – How to solve lambda expression conversion error ServiceLifetime net core type?

I started a very simple project with Net Core 2.2 and I faced the following error:
Unable to convert lambda expression to "ServiceLifetime" type because it is not a delegate type

Startup.cs Archive

public void ConfigureServices (IServiceCollection services)
services.Configurer(options =>
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;

services.AddDbContext(options =>
options.UseSqlServer (Configuration.GetConnectionString ("DefaultConnection")));

services.AddMvc () .SetCompatibilityVersion (CompatibilityVersion.Version_2_2);

insert the description of the image here


public class menu
public int MenuID {get; together; }
public string NmMenu {get; together;}
public int MenuIdPai {get; together; }



Public class Ctx: DbContext
Ctx public (DbContextOptions options)
: base (options)

public DbSet Menus {get; together; }

protected replace void OnModelCreating (ModelBuilder modelBuilder)
modelBuilder.Entity() .ToTable ("Menu");


"ConnectionStrings": {
"DefaultConnection": "Server = (localdb) \ mssqllocaldb; Database = Ctx; Trusted_Connection = True; MultipleActiveResultSets = true"
"Registration": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"

How to make sure that a URL returns a dynamic JSON with a custom content type?

Some antecedents first, I try to follow the instructions here:


get universal links working with my website for iOS devices. My wordpress site is in a shared hosting environment, so I do not have access to the server or any root files. I placed the file at the root of my site (httpdocs) and when I navigate to the page, it does not load. While searching on Google, I found a stackoverflow article indicating that you need to configure the server to allow it to serve this file with a type of content of type "application / pkcs7-mime" (Apple-app-site Config file -association with wordpress). As mentioned, I do not have access to that.

I have a subdomain which is a Microsoft Web API project that I know very well. I created an endpoint for "apple-app-site-association" and dynamically created the JSON response in the code, then set the content type and returned it. It ended up working and Apple detects it and everything. This is interesting because I do NOT need a file on my server because I generate it on the fly, and I do not need to change anything in terms of server.

The problem though is that I need the primary site domain to be the universal link, not the Windows subdomain. The main site is wordpress. I think it's possible to do the same thing in wordpress when I navigate to mydomain.com/apple-app-site-association and I generate the json and type of content on the fly and serve.

I have never coded with wordpress and I do not even know where to start.

If possible, I would like to have clear guidelines on the following:

  1. Make mydomain.com/apple-app-site-association lead to a custom function or a page used as a json.
  2. Have a code that makes the JSON be served dynamically.
  3. Have code that defines the content type of the response on "application / pkcs7-mime".

Of course, if anyone knows how to resolve the file not receiving a shared server without this method, I am also open to that. From what I can see, this is perhaps the only way to assume that this can be done.

entities – how to configure – type of profile entity missing form class

Get the following error,

Drupal Component Plugin Exception InvalidPluginDefinitionException:
The "profile" entity type did not specify an "employee" form class. in
Drupal Core Entity EntityTypeManager-> getFormObject () (line 223 of the

I've done some research and found the solution for the user entity types and nodes, but I'm not sure what that can be for profiles.

function mymodule_entity_type_build (array & $ entity_types) {
$ entity_types['user']-> setFormClass (& # 39; step1 & # 39 ;, "Drupal  user  RegisterForm"); // works for the registration form of the user

note what replacement needs to be done for

"Drupal user RegisterForm"

google sheets – ga: dcmLastEventAttributionType (CM (CM model) attribution type) with the latest interaction conversions

we have a Google form that uses the Google Analytics add-on.

we can get all kinds of "normal" metrics, but we need to extract our latest GA interaction conversions in this worksheet.

It seems that the dimension we need is ga: dcmLastEventAttributionType (CM assignment type (CM model))

But we can not find a metric to shoot with this dimension.

Has anyone managed to extract this type of data from the AG in Spreadsheets with this add-on?

In GA, the data we need in Conversions-> Attribution-> Model Comparison Tool (we then filter by campaign).

Is there a way to extract this data?

Please help,
Thank you.

7 – After saving the node type, entity_get_info ('node') missing the property 'token type'.

After registering a node type on admin / structure / types / manage / node-type, the token type & # 39; has disappeared:

$ info = entity_get_info (& # 39; node);
// isset ($ info['token type'])) == FALSE

After changing common.inc to refresh the entity information like this

if (FALSE && $ cache = cache_get ("entity_info: $ langcode")) {
$ entity_info = $ cache-> data;

it works again as expected.

Only the type of entity & # 39; node & # 39; is affected.

What can cause this problem?

Homotopic type of G-CW structure

Let $ G $ to be a finite group, and $ X $ be free $ G $-space. In addition, suppose that $ X $ has a homotopic type of a CW complex. Is $ X $ to have $ G $-homopie of a $ G $-CW complex too?

mysqli – mysqli_connect () mysqli_connect (): (HY000 / 2002): No file or directory error of this type when calling from another php file

I am a little weird here and I am unable to find the cause on the web search.

I have a functions.php file that contains the following code:

function random_color_part () {
returns str_pad (dechex (mt_rand (0, 255)), 2, & # 39; 0 & # 39; STR_PAD_LEFT);

random_html_color () {function
returns random_color_part (). random_color_part (). color_ random_part ();

function unique_random_colors ($ sql) {
$ link2 = mysqli_connect ($ DB_HOST, $ DB_USER, $ DB_PASS) or die (mysqli_connect_error ());
mysqli_select_db ($ link2, $ RMV_DB) or die (mysqli_error ($ link2));

$ m = array ();
if ($ query = mysqli_prepare ($ link2, $ sql)) {

mysqli_stmt_execute ($ query);
mysqli_stmt_bind_result ($ query, $ user_id);

while (mysqli_stmt_fetch ($ query)) {
$ m[$user_id] = random_html_color ();
} other {
returns FALSE;
mysqli_close ($ link2);
returns $ m;

In another file, let's call it main.php:

<? php
require_once (& # 39; functions.php & # 39;);
$ link = mysqli_connect ($ DB_HOST, $ DB_USER, $ DB_PASS) or die (mysqli_connect_error ());
$ my_stmt = SELECT DISTINCT user FROM articles_discussion WHERE article = & # 39; mysqli_real_escape_string ($ link, $ _GET['aid'])
print_r (unique_random_colors ($ my_stmt);
mysqli_close ($ link);

but I get the error mysqli_connect () mysqli_connect (): (HY000 / 2002): No such file or directory and he says that this is happening on the line depending unique_random_colors who reads $ link2 = mysqli_connect ($ DB_HOST, $ DB_USER, $ DB_PASS) or die (mysqli_connect_error ());

Why would this tell me that a file or directory does not exist? If I copy and paste the function code into a standalone file and run it with some modifications only to make it syntactically correct, it works fine. As soon as I try to call him from functions.php this gives the error.

ruby – I use Rails 4.1. How to define a new type of model identifier as bigint

I can not use bigint as my template ID as you normally would if you were using Rails 5

I want my model to have an auto-increment identifier as usual but I want it to be a bigint and not a regular integer

I first tried using a rail generator (like a good lazy developer)

who gave me

CreateTransactions class <ActiveRecord :: Migration
def change
create_table: transactions do not | t |
t.bigint: id
#more things omitted

Who can not migrate with 

method not defined `bigint 'for #

I've already tried to modify this to be

create_table: transactions, id: false do | t |
t.bigint: id

It works. The migration runs, but the incrementation fails automatically.

So I can not do Transaction.create or he screams at me from the database layer on a no constraint on the id.

Apparently, you can create a table and then modify it with colonne_changement but it did not reflect in the schema.rb so it worries me.

In addition, apparently, this is an irreversible migration, so I want to avoid that.

I use Rails 4.1 and Postgress and I know that there must be an easy / cool and fun way to make this work effective.

I want the db table to be a bigint for storage (

Its going to contain millions of records and the migration of identifiers later will be a headache requiring a time out


Gives me a new transaction where the identifier is defined as normal but it is a big int 8 bits not a normal int 4 bits

plugin development – The custom attribute type does not display the terms in the mount product – WooCommerce

I am faced with a problem where:

  1. I have created a custom attribute type
  2. Created an attribute, called "test"
  3. Adding a term to the attribute, called this "Hello"
  4. Go to edit the variants in the publishing product and I am not able to add terms. There is nothing to select as usual.

This is the code that I used to add a custom attribute type:

add_filter (& # 39; product_attributes_type_selector & # 39; function ($ array) {
$ table['test'] = __ (& # 39; Test & # 39 ;, & # 39; awcs & # 39;);

The code works, where it adds the type to the drop-down list when creating a new attribute, it is only variants of the attribute that do not appear in the product modification page.

framework entity – In ASP.NET, is the concept of complex type analogous to a view model?

Is a complex type in Entity Framework a view model in a view? As I understand it, the type of complex is a type that represents columns and / or fields from real EF entities. A view pattern is similar in that it has a class that has types from different sources. None of them can exist independently of the underlying real entities, models and classes.

If the complex type is Model and View is, are they analogous for understanding?