text:
Q: Create ASP.NET Identity tables using SQL script I am attempting to incorporate ASP.NET Identity into a new application that currently uses a SQL script to create the database schema. As we will need to create Foreign Key constraints from other tables to the user tables, it is highly desirable that the ASP.NET Identity tables are also created in the same scripts.
I have been able to extend the IdentityUser class in the ApplicationUser class created in IdentityModels.cs-
public class ApplicationUser : IdentityUser
{
    public ApplicationUser()
    {
        Sequence = 0;
        LastActivity = DateTime.Now;
    }

    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int NumericId
    {
        get;
        set;
    }

    [MaxLength(50), Required]
    public string DisplayName
    {
        get;
        set;
    }

    [MaxLength(50), Required]
    public string Description
    {
        get;
        set;
    }

    [IntegerValidator(MinValue = 0), Required]
    public int Sequence
    {
        get;
        set;
    }

    [MaxLength(50)]
    public string ExternalRef
    {
        get;
        set;
    }

    public DateTime? LoggedOn
    {
        get;
        set;
    }

    public DateTime? LoggedOff
    {
        get;
        set;
    }

    public DateTime LastActivity
    {
        get;
        set;
    }

    public int FailedLoginAttempts
    {
        get;
        set;
    }

    public DateTime? LockedOutUntil
    {
        get;
        set;
    }

    public int LockOutCycles
    {
        get;
        set;
    }

    public bool Approved
    {
        get;
        set;
    }
}

I have created the tables using the script-
CREATE TABLE [Users].[User] (
[Id] [nvarchar](128) NOT NULL
,[NumericId] [int] IDENTITY(1,1) NOT NULL
,[UserName] [nvarchar](50) NULL
,[PasswordHash] [nvarchar](max) NULL
,[SecurityStamp] [nvarchar](max) NULL
,[DisplayName] [nvarchar](50) NULL
,[Description] [nvarchar](50) NOT NULL
,[EmailAddress] [nvarchar](254) NOT NULL
,[Confirmed] [bit] NOT NULL
,[Sequence] [int] NOT NULL
,[ExternalRef] [nvarchar](50) NOT NULL
,[LoggedOn] [datetime] NULL
,[LoggedOff] [datetime] NULL
,[LastActivity] [datetime] NULL
,[FailedLoginAttempts] [int] NOT NULL
,[LockedOutUntil] [datetime] NULL
,[LockOutCycles] int NOT NULL
,[Approved] [bit] NOT NULL
,[Discriminator] [nvarchar](128) NOT NULL
,CONSTRAINT [PK_User] PRIMARY KEY NONCLUSTERED ([Id] ASC) WITH (
    PAD_INDEX = OFF
    ,STATISTICS_NORECOMPUTE = OFF
    ,IGNORE_DUP_KEY = OFF
    ,ALLOW_ROW_LOCKS = ON
    ,ALLOW_PAGE_LOCKS = ON
    ) ON [PRIMARY]
,CONSTRAINT [IX_User_NumericId] UNIQUE CLUSTERED ([NumericId] ASC) WITH (
    PAD_INDEX = OFF
    ,STATISTICS_NORECOMPUTE = OFF
    ,IGNORE_DUP_KEY = OFF
    ,ALLOW_ROW_LOCKS = ON
    ,ALLOW_PAGE_LOCKS = ON
    ) ON [PRIMARY]
,CONSTRAINT [IX_User_Name] UNIQUE NONCLUSTERED ([UserName] ASC) WITH (
    PAD_INDEX = OFF
    ,STATISTICS_NORECOMPUTE = OFF
    ,IGNORE_DUP_KEY = OFF
    ,ALLOW_ROW_LOCKS = ON
    ,ALLOW_PAGE_LOCKS = ON
    ) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [Users].[User] ADD CONSTRAINT [DF_User_Description] DEFAULT('')
FOR [Description]
GO

ALTER TABLE [Users].[User] ADD CONSTRAINT [DF_User_Sequence] DEFAULT((0))
FOR [Sequence]
GO

ALTER TABLE [Users].[User] ADD CONSTRAINT [DF_User_ExternalRef] DEFAULT('')
FOR [ExternalRef]
GO

ALTER TABLE [Users].[User] ADD CONSTRAINT [DF_User_FailedLoginAttempts] DEFAULT((0))
FOR [FailedLoginAttempts]
GO

ALTER TABLE [Users].[User] ADD CONSTRAINT [DF_User_LockOutCycles] DEFAULT((0))
FOR [LockOutCycles]
GO

CREATE NONCLUSTERED INDEX [IX_User_Sequence] ON [Users].[User] ([Sequence] ASC, [UserName] ASC)
    WITH (
            PAD_INDEX = OFF
            ,STATISTICS_NORECOMPUTE = OFF
            ,SORT_IN_TEMPDB = OFF
            ,IGNORE_DUP_KEY = OFF
            ,DROP_EXISTING = OFF
            ,ONLINE = OFF
            ,ALLOW_ROW_LOCKS = ON
            ,ALLOW_PAGE_LOCKS = ON
            ) ON [PRIMARY]
GO

CREATE TABLE [Users].[UserClaim](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [ClaimType] [nvarchar](max) NULL,
    [ClaimValue] [nvarchar](max) NULL,
    [UserId] [nvarchar](128) NOT NULL,
 CONSTRAINT [PK_Users.UserClaims] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF,
        STATISTICS_NORECOMPUTE = OFF,
        IGNORE_DUP_KEY = OFF,
        ALLOW_ROW_LOCKS = ON,
        ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

ALTER TABLE [Users].[UserClaim]  WITH CHECK ADD  CONSTRAINT [FK_Users.UserClaims_Users.User_User_Id] FOREIGN KEY([UserId])
REFERENCES [Users].[User] ([Id])
ON DELETE CASCADE
GO

ALTER TABLE [Users].[UserClaim] CHECK CONSTRAINT [FK_Users.UserClaims_Users.User_User_Id]
GO

CREATE TABLE [Users].[UserLogin](
    [UserId] [nvarchar](128) NOT NULL,
    [LoginProvider] [nvarchar](128) NOT NULL,
    [ProviderKey] [nvarchar](128) NOT NULL,
 CONSTRAINT [PK_Users.UserLogins] PRIMARY KEY CLUSTERED
(
    [UserId] ASC,
    [LoginProvider] ASC,
    [ProviderKey] ASC
)WITH (PAD_INDEX = OFF,
        STATISTICS_NORECOMPUTE = OFF,
        IGNORE_DUP_KEY = OFF,
        ALLOW_ROW_LOCKS = ON,
        ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [Users].[UserLogin]  WITH CHECK ADD  CONSTRAINT [FK_Users.UserLogins_Users.User_UserId] FOREIGN KEY([UserId])
REFERENCES [Users].[User] ([Id])
ON DELETE CASCADE
GO

ALTER TABLE [Users].[UserLogin] CHECK CONSTRAINT [FK_Users.UserLogins_Users.User_UserId]

CREATE TABLE [Users].[ApplicationRole](
    [Id] [nvarchar](128) NOT NULL,
    [Name] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_Users.ApplicationRole] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF,
        STATISTICS_NORECOMPUTE = OFF,
        IGNORE_DUP_KEY = OFF,
        ALLOW_ROW_LOCKS = ON,
        ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

CREATE TABLE [Users].[UserRole](
    [UserId] [nvarchar](128) NOT NULL,
    [RoleId] [nvarchar](128) NOT NULL,
 CONSTRAINT [PK_Users.UserRole] PRIMARY KEY CLUSTERED
(
    [UserId] ASC,
    [RoleId] ASC
)WITH (PAD_INDEX = OFF,
        STATISTICS_NORECOMPUTE = OFF,
        IGNORE_DUP_KEY = OFF,
        ALLOW_ROW_LOCKS = ON,
        ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [Users].[UserRole]  WITH CHECK ADD  CONSTRAINT [FK_Users.UserRole_Users.ApplicationRole_RoleId] FOREIGN KEY([RoleId])
REFERENCES [Users].[ApplicationRole] ([Id])
ON DELETE CASCADE
GO

ALTER TABLE [Users].[UserRole] CHECK CONSTRAINT [FK_Users.UserRole_Users.ApplicationRole_RoleId]
GO

ALTER TABLE [Users].[UserRole]  WITH CHECK ADD  CONSTRAINT [FK_Users.UserRole_Users.User_UserId] FOREIGN KEY([UserId])
REFERENCES [Users].[User] ([Id])
ON DELETE CASCADE
GO

ALTER TABLE [Users].[UserRole] CHECK CONSTRAINT [FK_Users.UserRole_Users.User_UserId]
GO

CREATE TABLE [Users].[Department](
    [Id] [int] IDENTITY(1, 1) NOT NULL
    ,[Name] [nvarchar](50) NOT NULL
    ,[Description] [nvarchar](50) NOT NULL
    ,[Sequence] [int] NOT NULL
 CONSTRAINT [PK_Users.Department] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF,
        STATISTICS_NORECOMPUTE = OFF,
        IGNORE_DUP_KEY = OFF,
        ALLOW_ROW_LOCKS = ON,
        ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

And have mapped the entities to the tables using an override on the OnModelCreating event-
public class ApplicationDbContext : IdentityDbContext<IdentityUser>
{
    public ApplicationDbContext()
        : base("DefaultConnection")
    {
    }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Entity<IdentityUser>().ToTable("User", "Users");

        modelBuilder.Entity<IdentityUser>().Property(iu => iu.Id).HasColumnName("Id");
        modelBuilder.Entity<IdentityUser>().Property(iu => iu.UserName).HasColumnName("UserName");
        modelBuilder.Entity<IdentityUser>().Property(iu => iu.Email).HasColumnName("EmailAddress").HasMaxLength(254).IsRequired();
        modelBuilder.Entity<IdentityUser>().Property(iu => iu.PasswordHash).HasColumnName("PasswordHash");
        modelBuilder.Entity<IdentityUser>().Property(iu => iu.SecurityStamp).HasColumnName("SecurityStamp");
        modelBuilder.Entity<IdentityUser>().Property(iu => iu.IsConfirmed).HasColumnName("Confirmed");

        modelBuilder.Entity<ApplicationUser>().HasKey(au => au.Id).ToTable("User", "Users"); //Specify our our own table names instead of the defaults

        modelBuilder.Entity<ApplicationUser>().Property(au => au.Id).HasColumnName("Id");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.NumericId).HasColumnName("NumericId");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.UserName).HasMaxLength(50).HasColumnName("UserName");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.PasswordHash).HasColumnName("PasswordHash");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.SecurityStamp).HasColumnName("SecurityStamp");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.DisplayName).HasColumnName("DisplayName");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.Description).HasColumnName("Description");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.Sequence).HasColumnName("Sequence");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.ExternalRef).HasColumnName("ExternalRef");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.LoggedOn).HasColumnName("LoggedOn");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.LoggedOff).HasColumnName("LoggedOff");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.LastActivity).HasColumnName("LastActivity");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.FailedLoginAttempts).IsOptional().HasColumnName("FailedLoginAttempts");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.LockedOutUntil).IsOptional().HasColumnName("LockedOutUntil");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.LockOutCycles).IsOptional().HasColumnName("LockOutCycles");
        modelBuilder.Entity<ApplicationUser>().Property(au => au.Approved).HasColumnName("Approved");

        modelBuilder.Entity<IdentityRole>().HasKey(ir => ir.Id).ToTable("ApplicationRole", "Users");

        modelBuilder.Entity<IdentityRole>().Property(ir => ir.Id).HasColumnName("Id");
        modelBuilder.Entity<IdentityRole>().Property(ir => ir.Name).HasColumnName("Name");

        modelBuilder.Entity<IdentityUserClaim>().HasKey(iuc => iuc.Id).ToTable("UserClaim", "Users");

        modelBuilder.Entity<IdentityUserClaim>().Property(iuc => iuc.Id).HasColumnName("Id");
        modelBuilder.Entity<IdentityUserClaim>().Property(iuc => iuc.ClaimType).HasColumnName("ClaimType");
        modelBuilder.Entity<IdentityUserClaim>().Property(iuc => iuc.ClaimValue).HasColumnName("ClaimValue");
        modelBuilder.Entity<IdentityUserClaim>().Property(iuc => iuc.UserId).HasColumnName("UserId");

        modelBuilder.Entity<IdentityUserLogin>().HasKey(iul => new { iul.UserId, iul.LoginProvider, iul.ProviderKey }).ToTable("UserLogin", "Users"); //Used for third party OAuth providers

        modelBuilder.Entity<IdentityUserLogin>().Property(iul => iul.UserId).HasColumnName("UserId");
        modelBuilder.Entity<IdentityUserLogin>().Property(iul => iul.LoginProvider).HasColumnName("LoginProvider");
        modelBuilder.Entity<IdentityUserLogin>().Property(iul => iul.ProviderKey).HasColumnName("ProviderKey");

        modelBuilder.Entity<IdentityUserRole>().HasKey(iur => new { iur.UserId, iur.RoleId }).ToTable("UserRole", "Users");

        modelBuilder.Entity<IdentityUserRole>().Property(ur => ur.UserId).HasColumnName("UserId");
        modelBuilder.Entity<IdentityUserRole>().Property(ur => ur.RoleId).HasColumnName("RoleId");
    }

This works well enough for registration, and indeed sign in post registration, but any attempt to sign in after this results in-

Exception Details: System.Data.SqlClient.SqlException:
Invalid column name 'IdentityUser_Id'.
Invalid column name 'IdentityUser_Id'.
Invalid column name 'Id'.
  Invalid column name 'IdentityRole_Id'.
Invalid column name 'IdentityUser_Id'.
Source Error:
Line 337: {
Line 338:
  AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
Line 339:
          var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
Line 340:
  AuthenticationManager.SignIn(new AuthenticationProperties { IsPersistent = isPersistent }, identity);
Line 341: }

I believe this is an issue with the Foreign Keys between the ApplicationUser and IdentityUserRole entities - these exist in the database but are not defined in the fluent API mappings. The fact that IdentityUser is a Complex Type seems to lead EF to assume that the columns are appended to the IdentityUserRole table (named "[User].[UserRole]") based on the generated query -
exec sp_executesql N'SELECT
[Extent1].[Id] AS [Id],
[Extent1].[UserId] AS [UserId],
[Extent1].[RoleId] AS [RoleId],
[Extent1].[IdentityRole_Id] AS [IdentityRole_Id],
[Extent1].[IdentityUser_Id] AS [IdentityUser_Id]
FROM [Users].[UserRole] AS [Extent1]
WHERE ([Extent1].[IdentityUser_Id] IS NOT NULL) AND ([Extent1].[IdentityUser_Id] =
@EntityKeyValue1)',N'@EntityKeyValue1 nvarchar(128)',
@EntityKeyValue1=N'2e16b5b5-6604-4f2c-9fbb-7cc3f5c9d4f3'
go

How can I configure the foreign keys in fluent API either from the ApplicationUser/IdentityUser and IdentityRole classes o point back to the "[Users].[User]" table, or from the IdentityUserRole class to point back to the user and role entities or tables? The foreign keys already exist in SQL.

A: So the new 1.1-alpha1 bits will have something close to the following by default.  This might be what you are looking for in regards to the Foreign Keys.  Note: this is a bit different than 1.0 as the navigation properties changed a bit to enable the ability to specify the primary key type:
We are trying to address some of the EF migration/extensibility issues, so things hopefully will be easier with Identity 1.1-alpha1 and the upcoming 6.0.2/6.1 EF releases, but I'm not sure the updated EF packages are available on myget yet.
    var user = modelBuilder.Entity<TUser>()
        .ToTable("AspNetUsers");
    user.HasMany(u => u.Roles).WithRequired().HasForeignKey(ur => ur.UserId);
    user.HasMany(u => u.Claims).WithRequired().HasForeignKey(uc => uc.UserId);
    user.HasMany(u => u.Logins).WithRequired().HasForeignKey(ul => ul.UserId);
    user.Property(u => u.UserName).IsRequired();

    modelBuilder.Entity<TUserRole>()
        .HasKey(r => new { r.UserId, r.RoleId })
        .ToTable("AspNetUserRoles");

    modelBuilder.Entity<TUserLogin>()
        .HasKey(l => new { l.UserId, l.LoginProvider, l.ProviderKey})
        .ToTable("AspNetUserLogins");

    modelBuilder.Entity<TUserClaim>()
        .ToTable("AspNetUserClaims");

    var role = modelBuilder.Entity<TRole>()
        .ToTable("AspNetRoles");
    role.Property(r => r.Name).IsRequired();
    role.HasMany(r => r.Users).WithRequired().HasForeignKey(ur => ur.RoleId);

A: The final (working) OnModelCreating method builds on the answer provided by Hao Kung (whose answer I have accepted and to whom I have awarded the bounty) to create the Foreign Key references from the IdentityUser/ApplicationUser side rather than attempting to do the same from the other direction.
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);

    var user = modelBuilder.Entity<IdentityUser>().HasKey(u => u.Id).ToTable("User", "Users"); //Specify our our own table names instead of the defaults

    user.Property(iu => iu.Id).HasColumnName("Id");
    user.Property(iu => iu.UserName).HasColumnName("UserName");
    user.Property(iu => iu.Email).HasColumnName("EmailAddress").HasMaxLength(254).IsRequired();
    user.Property(iu => iu.IsConfirmed).HasColumnName("EmailConfirmed");
    user.Property(iu => iu.PasswordHash).HasColumnName("PasswordHash");
    user.Property(iu => iu.SecurityStamp).HasColumnName("SecurityStamp");

    user.HasMany(u => u.Roles).WithRequired().HasForeignKey(ur => ur.UserId);
    user.HasMany(u => u.Claims).WithRequired().HasForeignKey(uc => uc.UserId);
    user.HasMany(u => u.Logins).WithRequired().HasForeignKey(ul => ul.UserId);
    user.Property(u => u.UserName).IsRequired();

    var applicationUser = modelBuilder.Entity<ApplicationUser>().HasKey(au => au.Id).ToTable("User", "Users"); //Specify our our own table names instead of the defaults

    applicationUser.Property(au => au.Id).HasColumnName("Id");
    applicationUser.Property(au => au.NumericId).HasColumnName("NumericId");
    applicationUser.Property(au => au.UserName).HasMaxLength(50).HasColumnName("UserName");
    applicationUser.Property(au => au.PasswordHash).HasColumnName("PasswordHash");
    applicationUser.Property(au => au.SecurityStamp).HasColumnName("SecurityStamp");
    applicationUser.Property(au => au.DisplayName).HasColumnName("DisplayName");
    applicationUser.Property(au => au.Description).HasColumnName("Description");
    applicationUser.Property(au => au.Email).HasColumnName("EmailAddress").HasMaxLength(254).IsRequired();
    applicationUser.Property(au => au.IsConfirmed).HasColumnName("EmailConfirmed");
    applicationUser.Property(au => au.Sequence).HasColumnName("Sequence");
    applicationUser.Property(au => au.ExternalRef).HasColumnName("ExternalRef");
    applicationUser.Property(au => au.LoggedOn).HasColumnName("LoggedOn");
    applicationUser.Property(au => au.LoggedOff).HasColumnName("LoggedOff");
    applicationUser.Property(au => au.LastActivity).HasColumnName("LastActivity");
    applicationUser.Property(au => au.FailedLoginAttempts).IsOptional().HasColumnName("FailedLoginAttempts");
    applicationUser.Property(au => au.LockedOutUntil).IsOptional().HasColumnName("LockedOutUntil");
    applicationUser.Property(au => au.LockOutCycles).IsOptional().HasColumnName("LockOutCycles");
    applicationUser.Property(au => au.Approved).HasColumnName("Approved");

    var role = modelBuilder.Entity<IdentityRole>().HasKey(ir => ir.Id).ToTable("ApplicationRole", "Users");

    role.Property(ir => ir.Id).HasColumnName("Id");
    role.Property(ir => ir.Name).HasColumnName("Name");

    var claim = modelBuilder.Entity<IdentityUserClaim>().HasKey(iuc => iuc.Id).ToTable("UserClaim", "Users");

    claim.Property(iuc => iuc.Id).HasColumnName("Id");
    claim.Property(iuc => iuc.ClaimType).HasColumnName("ClaimType");
    claim.Property(iuc => iuc.ClaimValue).HasColumnName("ClaimValue");
    claim.Property(iuc => iuc.UserId).HasColumnName("UserId");

    var login = modelBuilder.Entity<IdentityUserLogin>().HasKey(iul => new { iul.UserId, iul.LoginProvider, iul.ProviderKey }).ToTable("UserLogin", "Users"); //Used for third party OAuth providers

    login.Property(iul => iul.UserId).HasColumnName("UserId");
    login.Property(iul => iul.LoginProvider).HasColumnName("LoginProvider");
    login.Property(iul => iul.ProviderKey).HasColumnName("ProviderKey");

    var userRole = modelBuilder.Entity<IdentityUserRole>().HasKey(iur => new { iur.UserId, iur.RoleId }).ToTable("UserRole", "Users");

    userRole.Property(ur => ur.UserId).HasColumnName("UserId");
    userRole.Property(ur => ur.RoleId).HasColumnName("RoleId");
}

I also liked the (brilliant yet so simple I can't think why I didn't do it before) idea of referencing the  Model Builder Entity as a variable to use on each following fluent-api statement.
I referenced properties and foreign keys on both entities, although (in practice) it does not appear that this is required. On ASP.NET Identity 1.0 there was no problem omitting the property mappings, but since I have changed the names of Email and IsConfirmed database columns at least those needed to be mapped against the IdentityUser entity in ASP.NET Identity 1.1
Likewise the ApplicationUser class probably does not need to foreign key defined (as relationships are defined between the base class and the other entities) but I saw no harm in ensuring there was no assumption of additional foreign key columns on the other entity tables by adding a explicit definition - and it doesn't seem to have done any harm.

A: Not sure exactly what you are trying to achieve. It should be possible if you use the following as required:

*

*modelBuilder.ComplexType    // tell ef this a complex property, Just embed in table,

*modelBuilder.Ignore         // no table required.

Then when mapping foreign key fields , if you have a property that hold the Foreign key, tell ef
modelBuilder.Entity<T>().HasRequired(t => t.NAVPROP)
              .WithMany()
              .HasForeignKey(t => t.PropertyinTThatholdsFKID);

field_id is generated by EF when it sees a need to cater for a defined relationship and there was no defined foreignkey field.  So either you have the an extra relationship you dont expect or want. Or the the relationhip was not specified with the foreignkey field.

A: See How can I change the table names when using Visual Studio 2013 ASP.NET Identity? for more information (bottom of initial question). I think you just need to call base.onModelCreating(modelBuilder) before your fluent calls.
BEFORE your fluent calls, add:
base.onModelCreating(modelBuilder);

As far as the SQL Scripts:
Update-Database -Script

Also here is a codeproject with the schema scripted out already (although I realize the table names are different).
Edit
My Overridden OnModelCreating Method (notice the call to base.OnModelCreating(modelBuilder) call at the beginning):
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Entity<IdentityUser>().ToTable("User");

            modelBuilder.Entity<IdentityUser>().Property(iu => iu.Id).HasColumnName("Id");
            modelBuilder.Entity<IdentityUser>().Property(iu => iu.UserName).HasColumnName("UserName");

            /*IdentityUser does not have an Email property
            modelBuilder.Entity<IdentityUser>().Property(iu => iu.Email).HasColumnName("EmailAddress").HasMaxLength(254).IsRequired(); Not sure where this is from?*/

            modelBuilder.Entity<IdentityUser>().Property(iu => iu.PasswordHash).HasColumnName("PasswordHash");
            modelBuilder.Entity<IdentityUser>().Property(iu => iu.SecurityStamp).HasColumnName("SecurityStamp");

            /*Same - dont know where this is from?
            modelBuilder.Entity<IdentityUser>().Property(iu => iu.IsConfirmed).HasColumnName("Confirmed");*/

            modelBuilder.Entity<ApplicationUser>().HasKey(au => au.Id).ToTable("User"); //Specify our our own table names instead of the defaults

            modelBuilder.Entity<ApplicationUser>().Property(au => au.Id).HasColumnName("Id");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.NumericId).HasColumnName("NumericId");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.UserName).HasMaxLength(50).HasColumnName("UserName");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.SecurityStamp).HasColumnName("SecurityStamp");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.DisplayName).HasColumnName("DisplayName");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.Description).HasColumnName("Description");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.Sequence).HasColumnName("Sequence");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.ExternalRef).HasColumnName("ExternalRef");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.LoggedOn).HasColumnName("LoggedOn");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.LoggedOff).HasColumnName("LoggedOff");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.LastActivity).HasColumnName("LastActivity");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.FailedLoginAttempts).IsOptional().HasColumnName("FailedLoginAttempts");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.LockedOutUntil).IsOptional().HasColumnName("LockedOutUntil");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.LockOutCycles).IsOptional().HasColumnName("LockOutCycles");
            modelBuilder.Entity<ApplicationUser>().Property(au => au.Approved).HasColumnName("Approved");

            modelBuilder.Entity<IdentityRole>().HasKey(ir => ir.Id).ToTable("ApplicationRole");

            modelBuilder.Entity<IdentityRole>().Property(ir => ir.Id).HasColumnName("Id");
            modelBuilder.Entity<IdentityRole>().Property(ir => ir.Name).HasColumnName("Name");

            modelBuilder.Entity<IdentityUserClaim>().HasKey(iuc => iuc.Id).ToTable("UserClaim");

            modelBuilder.Entity<IdentityUserClaim>().Property(iuc => iuc.Id).HasColumnName("Id");
            modelBuilder.Entity<IdentityUserClaim>().Property(iuc => iuc.ClaimType).HasColumnName("ClaimType");
            modelBuilder.Entity<IdentityUserClaim>().Property(iuc => iuc.ClaimValue).HasColumnName("ClaimValue");
            //modelBuilder.Entity<IdentityUserClaim>().Property(iuc => iuc.UserId).HasColumnName("UserId");

            modelBuilder.Entity<IdentityUserLogin>().HasKey(iul => new { iul.UserId, iul.LoginProvider, iul.ProviderKey }).ToTable("UserLogin"); //Used for third party OAuth providers

            modelBuilder.Entity<IdentityUserLogin>().Property(iul => iul.UserId).HasColumnName("UserId");
            modelBuilder.Entity<IdentityUserLogin>().Property(iul => iul.LoginProvider).HasColumnName("LoginProvider");
            modelBuilder.Entity<IdentityUserLogin>().Property(iul => iul.ProviderKey).HasColumnName("ProviderKey");

            modelBuilder.Entity<IdentityUserRole>().HasKey(iur => new { iur.UserId, iur.RoleId }).ToTable("UserRole");

            modelBuilder.Entity<IdentityUserRole>().Property(ur => ur.UserId).HasColumnName("UserId");
            modelBuilder.Entity<IdentityUserRole>().Property(ur => ur.RoleId).HasColumnName("RoleId");

        }


text:
Q: Broadcasting 1s of a 2D matrix to a 1-hot 3D matrix Given the 2D matrix A, how can I broadcast it to create 3D matrix B?
A = [[1 1 1 1 0];[0 0 0 0 1]]
B = cat([[1 0 0 0 0];[0 0 0 0 0]],
        [[0 1 0 0 0];[0 0 0 0 0]],
        [[0 0 1 0 0];[0 0 0 0 0]],
        [[0 0 0 1 0];[0 0 0 0 0]],
        [[0 0 0 0 0];[0 0 0 0 1]], dims=3)

I've tagged numpy-broadcasting for this question because while I'm using Julia 1.2.0, Julia broadcasting is modelled on NumPy broadcasting, so there may be a similar shared solution.

A: I am not sure if this will meet your definition of "broadcasting", but a natural way to get what you want would be:
julia> cat(diagm.(getindex.(Ref(A), 1:2, :))..., dims=3)
5×5×2 Array{Int64,3}:
[:, :, 1] =
 1  0  0  0  0
 0  1  0  0  0
 0  0  1  0  0
 0  0  0  1  0
 0  0  0  0  0

[:, :, 2] =
 0  0  0  0  0
 0  0  0  0  0
 0  0  0  0  0
 0  0  0  0  0
 0  0  0  0  1

or if you would actually prefer to avoid broadcasting (which seems simpler in this case):
julia> cat((diagm(A[i, :]) for i in 1:2)..., dims=3)
5×5×2 Array{Int64,3}:
[:, :, 1] =
 1  0  0  0  0
 0  1  0  0  0
 0  0  1  0  0
 0  0  0  1  0
 0  0  0  0  0

[:, :, 2] =
 0  0  0  0  0
 0  0  0  0  0
 0  0  0  0  0
 0  0  0  0  0
 0  0  0  0  1

EDIT
Given your comment the easiest way to get exactly what you wanted is to use a comprehension:
[j==k ? A[i,j] : 0 for i in axes(A, 1), j in axes(A, 2), k in axes(A, 2)]

this is the same using broadcasting, but it is rather ugly:
((i,j,k) -> j==k ? A[i,j] : 0).(axes(A, 1), reshape(axes(A, 2), 1, :), reshape(axes(A, 2), 1, 1, :))

or
((i,j,k) -> j==k * A[i,j]).(axes(A, 1), reshape(axes(A, 2), 1, :), reshape(axes(A, 2), 1, 1, :))

redpajama_set_name: RedPajamaStackExchange


text:
Q: Does Kotlin have a network REPL like Clojure's `nrepl`? Clojure's nrepl provide a way to connect to a running remote Clojure program.
Does Kotlin have a network REPL like Clojure's nrepl?

A: maybe have a look at:
https://github.com/kscripting/kscript#treat-yourself-a-repl-with---interactive
maybe it comes near to what you want to have.
https://github.com/holgerbrandl/kscript
kscript by Holder Brandl adds enhanced scripting support for Kotlin on *nix-based systems. kscript provides an easy-to-use, very flexible, and almost zero-overhead solution to write self-contained mini-applications with Kotlin.
also available via https://sdkman.io/
$ sdk install kscript

For trying out small kotlin code snippets, I sometimes just use the scratches from my favorite IDE Intellij: https://www.jetbrains.com/help/idea/scratches.html
Maybe you find the latter also "helpful" for whatever you "intended" to achieve in using a REPL.

A: No there isn't  - maybe you can define the requirements and what/why you want and someone might develop it


text:
Q: Use xpath to select a node which has a greatest value for an attribute Given an xml document like this:
<node>
  <node text="text1" x=400 y=400></node>
</node>
<node>
  <node text="text1" x=400 y=900></node>
</node>
<node>
  <node text="text2" x=400 y=1000></node>
</node>
... etc ...

How would I write an xpath query to select the node where the text attribute is "text1" with the greatest value for y (in this case 900)?  I don't know exactly what the y value will be, but I do know that the node I am always supposed to be selecting is the one with the higher y value, and that the two nodes will not be siblings.  Aside from the y value, the two nodes I'm trying to differentiate between will have all attributes equal.

A: Your input document is not well-formed. It lacks a single outermost (root) element and some of the attribute values have no quotes. Given a well-formed input document like this:
<root>
<node>
  <node text="text1" x="400" y="400"></node>
</node>
<node>
  <node text="text1" x="400" y="900"></node>
</node>
<node>
  <node text="text2" x="400" y="1000"></node>
</node>
</root>

The following XPath expression:
//node[@text = 'text1' and not(@y < preceding::node[@text = 'text1']/@y or @y < following::node[@text = 'text1']/@y)]

finds the node element(s) that has text1 and the highest value in @y. In this case, the only result is
<node text="text1" x="400" y="900"/>

In more detail, the path expression means
//node                                              select all `node` elements, anywhere in
                                                    the document
[@text = 'text1'                                    but only if its `text` attribute is
                                                    equal to "text1"
and not(@y < preceding::node[@text = 'text1']/@y    and only if the value of its `y`
                                                    attribute is not lower than the value
                                                    of an `y` attribute of another `node`
                                                    element of the same sort that precedes
                                                    the current one
or @y < following::node[@text = 'text1']/@y)]       and only if the value if its `y`
                                                    attribute is not lower than the value
                                                    of an `y` attribute of another `node`
                                                    element of the same sort that follows
                                                    the current one

EDIT: Alternatively, use
//node[@text="text1" and not(//node[@text="text1"]/@y > @y)]

as splash58 has suggested. The semantics of this expression are very similar to the one above.


text:
Q: How to get the list of employees from specific LDAP group from MarkLogic XQuery? How can I get the list of employees from specific LDAP group using MarkLogic XQuery?

A: You could use the xdmp:ldap-search() method to search for users that belong to the specified group.
Something like this:
xdmp:ldap-search(
  "(&(objectCategory=user)(memberOf=cn=MyCustomGroup))",
  <options xmlns="xdmp:ldap">
    <username>admin</username>
    <password>admin</password>
    <server-uri>ldap://dc1.mltest1.local:389</server-uri>
    <search-base>CN=Users,DC=MLTEST1,DC=LOCAL</search-base>
  </options>)


text:
Q: pandas - join two dataframe and then transpose by a date I have two pandas dataframes. First have data how many hours person spent doing what that day.
Second dataframe is Sum of the day and the hours the person actually were in work. Examples here:
df_1:
| name | id | description    | hours_worked | date       |
| ---- | -- | -------------- | ------------ | ---------- |
| John | 1  | implementation | 5            | 2020-11-16 |
| John | 1  | refactor       | 3            | 2020-11-16 |
| John | 1  | implementation | 8            | 2020-11-17 |
| Paul | 2  | refactor       | 4            | 2020-11-16 |

df_2:
| name | id | hours_charged  | hours_worked | date       |
| ---- | -- | -------------- | ------------ | ---------- |
| John | 1  | 8              | 8            | 2020-11-16 |
| John | 1  | 8              | 8            | 2020-11-17 |
| Paul | 2  | 8              | 4            | 2020-11-16 |

Is there any way how to combine these two DFs and get this result:
df_final:
| name | id | description      | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
| ---- | -- | ---------------- | ------ | ------  | --------- | -------- | ------ | -------- | ------ |
| John | 1  | hours_worked     |   8    | 8       | 0         | 0        | 0      | 0        | 0      |
| John | 1  | hours_charged    |   8    | 8       | 0         | 0        | 0      | 0        | 0      |
| John | 1  | implementation   |   5    | 8       | 0         | 0        | 0      | 0        | 0      |
| John | 1  | refactor         |   3    | 0       | 0         | 0        | 0      | 0        | 0      |
| Paul | 2  | hours_worked     |   4    | 0       | 0         | 0        | 0      | 0        | 0      |
| Paul | 2  | hours_charged    |   8    | 0       | 0         | 0        | 0      | 0        | 0      |
| Paul | 2  | refactor         |   4    | 0       | 0         | 0        | 0      | 0        | 0      |

Basically transpose the dates and then get on the row data from hours_worked, hours_charged and then list all hours_worked based on description. I tried to merge the two DFs but I dont know how to transpose it this way.

A: Use DataFrame.melt for unpivot for second df, join by concat, convert datetimes by Series.dt.day_name and use DataFrame.pivot_table with some aggregate function, e.g. sum, last add missing columns by list:
df1 = df_1.rename(columns={'hours_worked':'value'})
df2 = df_2.melt(['name','id','date'], var_name='description')

df = pd.concat([df1, df2])
df['date'] = pd.to_datetime(df['date']).dt.day_name()

days = ['Monday', 'Tuesday','Wednesday', 'Thursday', 'Friday','Saturday','Sunday']
df1 = (df.pivot_table(index=['name','id','description'],
                      columns='date',
                      values='value',
                      aggfunc='sum', fill_value=0)
        .reindex(days, fill_value=0, axis=1)
        .reset_index()
        .rename_axis(None,axis=1))
print (df1)
   name  id     description  Monday  Tuesday  Wednesday  Thursday  Friday  \
0  John   1   hours_charged       8        8          0         0       0
1  John   1    hours_worked       8        8          0         0       0
2  John   1  implementation       5        8          0         0       0
3  John   1        refactor       3        0          0         0       0
4  Paul   2   hours_charged       8        0          0         0       0
5  Paul   2    hours_worked       4        0          0         0       0
6  Paul   2        refactor       4        0          0         0       0

   Saturday  Sunday
0         0       0
1         0       0
2         0       0
3         0       0
4         0       0
5         0       0
6         0       0


text:
Q: vtiger CRM - 7.1.0 - How to find the Invite Users actions? I want to implement the Invite User actions located in the Calendar>Events to Project.
I've tried searching in the Workflows and other settings but I couldn't find where is the actions located.

A: Invtite Users does not have any UI for configuration. you have to modify the following files for your customization.
modules/Events/models/Module.php | function -> saveRecord | Between lines -> 28-40
modules/Events/models/Record.php | function -> getInviteUserMailData| Between lines -> 136-189
modules/Calendar/CalendarCommon.php | function -> sendInvitation| Between lines -> 150-181


text:
Q: Maclaurin series therom question of artan find the Maclaurin series of $$\frac{1}{1+4x^2}$$ and $$\frac{1}{1+9x^2}$$ using $$\arctan x = \sum_{n=0}^{\infty} (-1)^n \frac{x^{2n+1}}{2n+1}$$
Firstly I derived the formula they gave us, then substituted $x \rightarrow 9x$.
Is this the right approach?

A: As you know that:
$$ \arctan(x) = \sum_{n=0}^{\infty} (-1)^n \frac{x^{2n+1}}{2n+1} \quad\Rightarrow\quad \arctan (2x) = \sum_{n=0}^{\infty} (-1)^n \frac{(2x)^{2n+1}}{2n+1} $$
Also, you have:
$$ \frac{d}{dx}\left[\arctan(x)\right] = \frac{1}{1+x^2} \quad\Rightarrow\quad \frac{d}{dx}\left[\arctan(2x)\right] = \frac{2}{1+4x^2} $$
Thus,
$$
\begin{align}
\color{red}{\frac{1}{1+4x^2}} &= \frac{1}{2}\,\frac{d}{dx} \left[\color{white}{\frac{}{}}\arctan(2x)\color{white}{\frac{}{}}\right] = \frac{1}{2}\,\frac{d}{dx} \left[\,\sum_{n=0}^{\infty}(-1)^n\,\frac{(2x)^{2n+1}}{2n+1}\,\right] \\[2mm]
&= \frac{1}{2}\,\sum_{n=0}^{\infty}(-1)^n\,\frac{\left(\,(2x)^{2n+1}\,\right)'}{2n+1} \\[2mm]
&= \frac{1}{2}\,\sum_{n=0}^{\infty}(-1)^n\,\frac{{2\,(2n+1)}\,(2x)^{2n}}{2n+1} \\[2mm]
&= \color{red}{\sum_{n=0}^{\infty}(-1)^n\,(2x)^{2n}}
\end{align}
$$
And with similar analysis, you should get:
$$ \frac{1}{1+9x^2}=\sum_{n=0}^{\infty}(-1)^n\,(3x)^{2n} $$


text:
Q: mutlipe buttons choice android I'm wondering how to make multiple buttons, which have the ability to go back after a certain amount of clicks. when i hit the third incorrect button it doesn't go back. please can someone tell me where im going wrong.
after the third attempt it should close the activity
private boolean answer = false;
private int turnsLeft = 0;
Button btn1;
Button btn2;
Button btn3;
Button btn4;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cat);

    btn1 = (Button) findViewById(R.id.btn1);
    btn1.setOnClickListener(this);

    btn2 = (Button) findViewById(R.id.btn2);
    btn2.setOnClickListener(this);

    btn3 = (Button) findViewById(R.id.btn3);
    btn3.setOnClickListener(this);

    btn4 = (Button) findViewById(R.id.btn4);
    btn4.setOnClickListener(this);

}

public void onClick (View view){
    switch (view.getId()){
        case R.id.btn1: {
            Intent intent  = new Intent(Cat.this,Congratulations.class);
            startActivity(intent);
            break;
        }
        case R.id.btn2: {
           animalButtonClicked(btn2,turnsLeft);
            break;
        }
        case R.id.btn3: {
            animalButtonClicked(btn3,turnsLeft);
            break;
        }
        case R.id.btn4: {
            animalButtonClicked(btn4,turnsLeft);
            break;
        }
        default:{
            break;
        }
    }
}

private int animalButtonClicked(Button button, int count){
    button.setEnabled(false);
    count++;

    if(count == 3){
        count = 0;
        finish();
    }
    button.setEnabled(false);
    return count;
}

A: You are passing turnsLeft global variable to the method. But incrementing only the local variable "count". It does not affect the global variable. So the turnsLeft is always 0.
change your code like this for all buttons click,
animalButtonClicked(btn2, ++turnsLeft);

and remove the line count++ from the method.
Another solution is not at all to pass the global variable "turnsLeft" to the method. As it is a global variable, you could access the variable turnsLeft directly inside the method, instead of using the local variable "count".


text:
Q: selenium ide - login inputs doesn't enable button I am trying to automate login process for a website.
In the login screen, we have username, password and login button.
This login button will be enabled only when both username and password are entered.
While recording via selenium IDE,the button is getting enabled. But when i try playing the testcase, I am getting exception as '[error] Element xpath=(//ul[@id='main-nav']/li[3]/a/img)2 not found'
I tried researching about this issue and there were suggestions to use 'sendKeys', 'fireEvent'.. But nothing works for me.. Please help me to resolve this issue..
Link : Selenium Test Case Screenshot with code and exception
Solution: Selenium Test Case Screenshot with working code
Thanks,
Suriya

A: One of the solutions for this issue is that once you are done with entering the UserName and Password, just click on any other webElement on the Page before clicking the Login Button. It might work for you. There are few instances wherein the login button only enables when the user enters a username AND password.
Insert the code in between password and Login Command,
Command   Target                    Value
click     //(WebElement Xpath)

A: I see 2 possible reasons why you are getting that error..

*

*Basing from the screenshot you provided, your test case program execution is too fast so you need to set the test speed to slowest.

*The xpath:idRelative value consistently changes every after session so you need to try a different locator. Ex: css or xpath:locator


text:
Q: The value of $b$, if $\lim_{x \to 0}(\frac{ae^x-b\cos x+ce^{-x}}{x\sin x})=2$ Question :
The value of $b$, if
$$\lim_{x \to 0^+}(\frac{ae^x-b\cos x+ce^{-x}}{x\sin x})=2$$
Solution : $$= \lim_{x \to 0^+} \frac{\log_e\left[\frac{4^x-3^x}{4^x-1}\right]}{x}(4^x-1)$$
$$= \lim_{x \to 0^+} \frac{\left[1-\frac{3^x-1}{4^x-1}\right]}{\left(\frac{3^x-1}{4^x-1}\right)}\times  \frac{3^x-1}{4^x-1}\times  \frac{4^x-1}{x}$$
I am unable to take it further. Please help on this thanks

A: Using Taylor series and taking an asymptotic equivalent of the order $2$ we get
$$\frac{ae^x-bcosx+ce^{-x}}{x\sin x}\sim_0\frac{a+ax+a\frac{x^2}2-b+b\frac{x^2}{2}+c-cx+c\frac{x^2}{2}}{x^2}$$
so we see that the desired limit is $2$ if and only if
$$a-b+c=0\quad;\quad a-c=0\quad;\quad a+b+c=4$$
hence we get $b=2$.

A: We start with Taylorexpanding the numerator and denominator:
\begin{align}
&\lim_{x \to 0^+}\left(\frac{ae^x-b\cos(x)+ce^{-x}}{x\sin(x)}\right)\\
=&\lim_{x \to 0^+}\left(\frac{a+ax+\frac{1}{2}ax^2-b(1-\frac{1}{2}x^2)+c-cx+\frac{1}{2}cx^2+O(x^3)}{x^2+O(x^3)}\right)\\
=&\lim_{x \to 0^+}\left(\frac{a+c-b+(a-c)x+\frac{1}{2}(a+b+c)x^2+O(x^3)}{x^2+O(x^3)}\right)=2\\
\end{align}
From this follows $a+c-b=0$ and $a+b+c=4$. We conclude that $b=2$


text:
Q: Turn off adverts for Macos upgrades (while keeping automatic updates) I'm running MacOS Catalina. I get two kinds of notifications about updating my OS:

*

*notifications about security updates to Catalina if they couldn't be installed automatically

*reminders to upgrade to MacOS Monterey
The first type of notification is useful - I want to keep Catalina up to date. The second type is not useful for me because I don't want to upgrade to Monterey at this time. These second types of notification are particularly annoying because they can't be dismissed - the only options are "install" or "learn more", which opens a browser window.
I would like to get rid of the second type of notification, without turning off automatic updates to Catalina. Is there a way to do that?
Note that is a related but different issue to Stop notifying me about Monterey upgrade, because I'm talking about pop-up notifications rather than a red "1" on the system update icon.


text:
Q: Append a link to all timecodes (Like YouTube) i want to find all timecodes in my content area and build a simple link around it, so i can jump to a specific timecode on my Wordpress Mediaelement.
How can I do this so it finally looks like:

    ****15:30**** "Title"

A: I figured it out by myself, here is my solution:
var str=document.getElementById("timecodes").innerHTML;
var n=str.replace(/[0-9][0-9][:][0-9][0-9]/gi,function myFunction(x){return "" + x + "";});
document.getElementById("timecodes").innerHTML=n;


text:
Q: Installing Ubuntu server after Ubuntu desktop I have Ubuntu desktop.  How do I install LAMP to run on it or can I?

A: You can install server packages on top of the desktop version, using tasksel like you would during a server installation.
sudo apt-get install tasksel
You can then run tasksel with sudo and select "LAMP Server" as you would with a server version installation.
That is the easiest way to setup a LAMP server on Desktop without installing all the packages by hand.


text:
Q: Toggle button crashes when turned on/off more than once I can touch the toggle button on (once) and off (once), but if I touch it a third time, it turns on but never plays the music. From there, when I touch it again to turn it off it crashes.
public class Main extends Activity {

MediaPlayer mp;
Button startButton;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);
    mp = MediaPlayer.create(getBaseContext(), R.raw.songthing);

    ToggleButton toggle = (ToggleButton) findViewById(R.id.ToggleButton);
    toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView,
                boolean isChecked) {
            if (isChecked) {
                mp.start();
            } else {
                mp.stop();
            }
        }
    });

    mp.setOnCompletionListener(new OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mp) {
            mp.release();
        }
    });

}

I'm not sure if I should have it within the onCreate method... I've tried to move it but I get very confused with all the brackets and it doesn't work out.
A little more about my code... I'm trying to get the media player to play a song when the toggle button is on and stop it when its off.
EDIT: Logcat says something about java.lang.IllegalStateException
XML:
<ToggleButton
        android:id="@+id/ToggleButton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:textOff="Start"
        android:textOn="Stop" />

A: You can read a bit about the MediaPlayer states here.
If you call stop(), you have to prepare() the player again before you can start() it.

Once in the Stopped state, playback cannot be started until prepare() or prepareAsync() are called to set the MediaPlayer object to the Prepared state again.

If preparing the player takes too long, consider using pause() followed by seekTo(0); as an alternative.


text:
Q: No sound in headphone jack Worked fine a week ago. Yesterday when I plugged headphones into my Asus laptop, I got sound both from headphones and speakers. Today after system crash (not sure what was the reason) when I plug headphones, speakers are muted automatically but there is no sound from headphones.
# lspci -v
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
    Subsystem: ASUSTeK Computer Inc. Device 124d
    Flags: bus master, fast devsel, latency 0, IRQ 45
    Memory at f7a10000 (64-bit, non-prefetchable) [size=16K]
    Capabilities: [50] Power Management version 2
    Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
    Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
    Capabilities: [100] Virtual Channel
    Capabilities: [130] Root Complex Link
    Kernel driver in use: snd_hda_intel

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC270 Analog [ALC270 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I've found few suggestions to add options snd-hda-intel model=auto or options snd-hda-intel model=laptop to /etc/modprobe.d/alsa-base.conf. I did that too, restarted alsa-utils but that didn't help at all.
Also tried this superuser answer already. No luck either - auto mute is enabled. Also channels aren't muted:
┌───────────────────────────── AlsaMixer v1.0.25 ──────────────────────────────┐
│ Card: HDA Intel PCH                                  F1:  Help               │
│ Chip: Intel PantherPoint HDMI                        F2:  System information │
│ View: F3:[Playback] F4: Capture  F5: All             F6:  Select sound card  │
│ Item: Master [dB gain: -16.50]                       Esc: Exit               │
│                                                                              │
│    ┌──┐       ┌──┐       ┌──┐       ┌──┐       ┌──┐                          │
│    │  │       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │  │       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │  │       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │  │       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │  │       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │  │       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │▒▒│       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │▒▒│       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │▒▒│       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │▒▒│       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    │▒▒│       │▒▒│       │▒▒│       │▒▒│       │▒▒│                          │
│    ├──┤       ├──┤       ├──┤       └──┘       └──┘       ┌──┐     Enabled   │
│    │OO│       │OO│       │OO│                             │MM│               │
│    └──┘       └──┘       └──┘                             └──┘               │
│     49      100<>100   100<>100   100<>100   100<>100                        │
│<  Master  >Headphone   Speaker      PCM     Mic Boost    S/PDIF   Auto-Mute  │
└──────────────────────────────────────────────────────────────────────────────┘

Basically I'm using vanilla Debian Wheezy with all updates installed. Everything worked fine few days ago. I can't recall if I installed any alsa related updates recently.


text:
Q: Load only new or updated css classes as page load finishes Cached css file is loading on page load, i want to load only new or updated css classes through an ajax request. Like in git repository we can easily get difference between two file version. Please help me in this.

A: Just add a random query string for your css file like ...styles.css?v1 on every edit.
or if you are using php or any other server side language add timestamp or random number as querystring  styles.css?<?=time();?>


text:
Q: WPML Latest Version Conflit with WordPress 6.1 Version [All Language pages redirect to main language] (Solution) WordPress launch there 3rd big release of 2022 which is 6.1, WPML also release a latest version on 10th Novemenber 2022, When you update WordPress and also Update WPML plugin to latest version then your website completely messed up, like if you open a German Version of your page then it will redirect to main language page which is English or any other language you make the parent.
How to solve that problem:
Solution # 1:
-> Delete your WPML complete Plugin, when you delete WPML plugin it will not remove your Translations from database so don't worry about that, you can easily remove WPML plugin from your WordPress Admin panel.
-> Install Old Plugin which is WPML 4.5.7
It will solve your problem
Solution #2:
-> If you already have backup of your website and your planing to revert WPML plugin to old WPML plugin, then revert all site_press_multilingual Plugin to New Plugin.
->Go to Database -> wp_options -> run this sql command
select * from wp_options where option_name = 'icl_sitepress_settings'

Once you have that colume edit its value to the value you go for your backup, and clear cache of your site and check it will start working perfectly fine.
I face this issue on last sunday try to find its solution for 2 continuous days but didn't found any valuable answer then i figure out this issue by my own self so I'm sharing this might help those people who already facing this issue because you can't find its solution online
Solution is explained above which help everyong to solve that problem


text:
Q: Play Spotify playlist or album music in my iOS app
Error Domain=com.spotify.ios-sdk.playback Code=1 "The operation failed due to an unspecified issue." UserInfo={NSLocalizedDescription=The operation failed due to an unspecified issue

Here is my code
func getAlbums(authSession:SPTSession){

    SPTPlaylistList.playlists(forUser: authSession.canonicalUsername, withAccessToken: authSession.accessToken) { (error, response) in
        if let listPage = response as? SPTPlaylistList, let albums = listPage.items as? [SPTPartialPlaylist]{

            for item in albums{
                let stringFromUrl =  item.uri
                // use SPTPlaylistSnapshot to get all the playlists
                print("************************\(item.name)************************")
                SPTPlaylistSnapshot.playlist(withURI: stringFromUrl, accessToken: authSession.accessToken!) { (error, snap) in
                    if let s = snap as? SPTPlaylistSnapshot {
                        print("====================\(s.name)=====================")

                        // get the tracks for each playlist
                        SpotifyManager.MyAlbums.append(s)
                        if SpotifyManager.MyAlbums.count == albums.count{
                            NotificationCenter.default.post(name: NSNotification.Name(rawValue: relodNotification), object: nil)
                        }
                    }
                }
            }
        }
    }
}

This error comes from this method
@objc func play() {

    print(songInfo.uri)
    SpotifyManager.player?.playSpotifyURI(self.songInfo.uri.absoluteString, startingWith: 0, startingWithPosition: 0, callback: { (err) in

        print(err.debugDescription)

    })
}

if anybody face this type of problem please give me the best solution to play the Spotify music in my app.

A: Just remove the looping because the player does that automatically for you!


text:
Q: How do I call a static child function from parent static function? How do I call child function from parent static function ?
In php5.3 there is a built in method called get_called_class() to call child method from parent class. But my server is running with php 5.1.
Is there any way can do this ?
I want to call it from a static function . So that I can not use "$this"
So i should use "self" keyword.
Below example my parent class is "Test123" , from the parent class static function "myfunc" am trying to call child class function like this "self::test();"
abstract class Test123
{

  function __construct()
  {
    // some code here
  }

  public static function myfunc()
  {
    self::test();
  }

  abstract function test();
}

class Test123456 extends Test123
{
  function __construct()
  {
    parent::__construct();
  }

  function test()
  {
    echo "So you managed to call me !!";
  }

}

$fish = new Test123456();
$fish->test();
$fish->myfunc();

A: Edit: What you try to achieve is not possible with PHP 5.1. There is no late static bindings PHP Manual in PHP 5.1, you need to explicitly name the child class to call the child function: Test123456::test(), self will be Test123 in a static function of the class Test123 (always) and the static keyword is not available to call a static function in PHP 5.1.
Related: new self vs new static; PHP 5.2 Equivalent to Late Static Binding (new static)?

If you are referring to a static parent function, then you need to explicitly name the parent (or child) for the function call in php 5.1:
parentClass::func();
Test123456::test();

In PHP 5.3 you can do this instead with the static keyword PHP Manual to resolve the called class' name:
static::func();
static::test();

If those are non-static, just use $this PHP Manual:
$this->parentFunc();
$this->childFunc();

Or if it has the same name, use parent PHP Manual:
parent::parentFunc();

(which is not exactly what you asked for, just putting it here for completeness).
Get_called_class() has been introduced for very specific cases like to late static bindings PHP Manual.
See Object Inheritance PHP Manual

A: I suspect you are a bit confused abuot parent / child, class / object and function / method.
Ionuț G. Stan has provided the explanation of how to invoke a method which is not declared in a parent class (which as he says should be abstract or implement the __call() method).
However if you mean how do invoke a method which has been overridden in a child class from the parent, then it is not possible - nor should it be. Consider:
Class shape {
 ...
}

Class circle extends shape {
  function area() {

  }
}
Class square extends shape {
  function area() {

  }
}

If it is your intent to call the area method on an instance of 'shape' (which does not have an area method) then which child should it use? Both the child methods would depend on properties which are not common / not implemented by the shape class.

A: try this:
<?php
 class A {
 public static function newInstance() {
$rv = new static();
return $rv;
}

public function __construct() { echo " A::__construct\n"; }
}
class B extends A {
public function __construct() { echo " B::__construct\n"; }
}
class C extends B {
public function __construct() { echo " C::__construct\n"; }
}
?>


text:
Q: Json array add onto php array I want to acheive something simliar to this adding elements onto an array but when I use this methods two nodes get created in the json element. I only want one node with all the entires within that also can you name nodes ie Properties.
$json = array();

while($row = mysql_fetch_assoc($sth)) {
    $json['name'] = $row['name'];
    $json['id'] = $row['id'];
    $data[] = $json;
}

$custom = array('name'=>'foo', 'id' => 'bar');
$data[] = $custom;

A: Try this code array_push is better option here,
    <?php
    $json = array();

    while($row = mysql_fetch_assoc($sth)) {
        $temp = array();
        $temp = array('name' => $row['name'], 'id' => $row['id']);
        array_push($json, $temp);
    }

    $custom = array('name'=>'foo', 'id' => 'bar');
    array_push($json,$custom);

   ?>


text:
Q: Encoding JSON serialized for URL I have to create a webrequest using HTTP GET and I have to add on the url a JSON serialized and encoded with all parameters.
But I have a problem when I'm encoding the serialized object, they encode also symbols like "{" and ":"
I would like to know what I have to do in order to encode the serialized object like the followed above:
Serialized Object:

{\"Name\":\"Bob\"}

Encoded With HttpUtility.Utility, or another encoder will encode all symbols:like  "{" ":"

"%7b%22Name%22%3a%22Bob%22%2

What I'm looking for:
http://tmpserviceURL.test?parameters={%20%22Name%22:%20%22Bob%22}

A: @Ant P is correct: you want those characters to be encoded.  It is a bad idea not to encode them.
HttpUtility.UrlEncode and other similar methods encode {, } and : because they MUST do so per section 2.2 of the Uniform Resource Locators specification (RFC 1738).
From page 2:

Octets [within a URL] must be encoded if they have no corresponding graphic
     character within the US-ASCII coded character set, if the use of the
     corresponding character is unsafe, or if the corresponding character
     is reserved for some other interpretation within the particular URL
     scheme.

The spec goes on to define : as being in the set of "reserved" characters (those that have special meaning within a URL), and defines { and } as being in the set of "unsafe" characters (those that are known to be sometimes modified by gateways and other transport agents).
So, in short, if you send these characters unencoded in a URL, then you risk the URL not being interpretted correctly, or the data being corrupted by the time it reaches its destination.  It may work sometimes, but you can't rely on it always working.
If you really feel you must ignore the URL spec, then you will have to roll your own URL encoder that does not encode those particular characters.  I doubt you're going to find an off-the-shelf encoder that allows you to do this.


text:
Q: What do you think is the best approach for creating a data mapping layer in python? I would appreciate hearing some opinions on the best approach to creating a light-weight data mapping layer between some python objects and a postgres database. I'm using the psycopg2 library, and plan to use pgbouncer. I looked at this: http://codeinthehole.com/writing/domain-model-mapper-a-php-data-mapper-implementation/ for a basic idea, but it isn't clear how they are closing the connection after the queries. The component I'm building is similar to a forum in that it has your familiar user, post, forum tables, etc.

A: The best approach is not to create a new layer, but to use an existing one.  SQLAlchemy is the most full-featured, but others are also good, such as Storm.
Maybe you could explain why you want to write a new one?


text:
Q: How to change the date format from yearmon to yyyy-mm-dd? My ultimate bjective is to plot the monthly S&P 500, Sotheby's, and Industrial Production into one normalized ggplot2, including recession bars.
I collect my data via quantmod and Quandl:
#======= LOAD PACKAGES ====================================
library(tseries)
library(quantmod)
library(Quandl)
library(ggplot2)
library(forecast)
library(urca)

#======= DATA IMPORT ======================================
env1 = new.env()
getSymbols("^GSPC", env = env1, src ="yahoo", from = as.Date("1988-06-01"),to = as.Date("2013-04-01"))
GSPC = env1$GSPC
gspc.df = data.frame(date=time(GSPC), coredata(GSPC))

env2 = new.env()
getSymbols("BID", env = env2, src ="yahoo", from = as.Date("1988-06-01"),to = as.Date("2013-04-01"))
BID = env2$BID
sothebys.df = data.frame(date=time(BID), coredata(BID))

INDPRO <- Quandl("FRED/INDPRO", start_date="1988-06-01",end_date="2013-05-29",type="xts")
indpro.df = data.frame(date=time(INDPRO), coredata(INDPRO))

Afterwards, I transform the daily data to monthly data:
# Transform data to monthly time series
GSPCM <- to.monthly(GSPC)
gspcm.df = data.frame(date=time(GSPCM), coredata(GSPCM))

BIDM <- to.monthly(BID)
sothebysm.df = data.frame(date=time(BIDM), coredata(BIDM))

INDPROM <- to.monthly(INDPRO)
indprom.df = data.frame(date=time(INDPROM), coredata(INDPROM))

Then, I am constructing the data.frame for the plot:
# Build the dataframe with monthly dates and stock prices to be used in graphing
dfm = data.frame(Date = gspcm.df$date, GSPCM = gspcm.df$GSPC.Adjusted, BIDM = sothebysm.df$BID.Adjusted, INDPROM = indprom.df$INDPRO.Close)

Finally, I try to build a ggplot2 with recession bars as described (See Link):
recessions.df = read.table(textConnection(
  "Peak, Trough
  1857-06-01, 1858-12-01
  1860-10-01, 1861-06-01
  1865-04-01, 1867-12-01
  1869-06-01, 1870-12-01
  1873-10-01, 1879-03-01
  1882-03-01, 1885-05-01
  1887-03-01, 1888-04-01
  1890-07-01, 1891-05-01
  1893-01-01, 1894-06-01
  1895-12-01, 1897-06-01
  1899-06-01, 1900-12-01
  1902-09-01, 1904-08-01
  1907-05-01, 1908-06-01
  1910-01-01, 1912-01-01
  1913-01-01, 1914-12-01
  1918-08-01, 1919-03-01
  1920-01-01, 1921-07-01
  1923-05-01, 1924-07-01
  1926-10-01, 1927-11-01
  1929-08-01, 1933-03-01
  1937-05-01, 1938-06-01
  1945-02-01, 1945-10-01
  1948-11-01, 1949-10-01
  1953-07-01, 1954-05-01
  1957-08-01, 1958-04-01
  1960-04-01, 1961-02-01
  1969-12-01, 1970-11-01
  1973-11-01, 1975-03-01
  1980-01-01, 1980-07-01
  1981-07-01, 1982-11-01
  1990-07-01, 1991-03-01
  2001-03-01, 2001-11-01
  2007-12-01, 2009-06-01"), sep=',',
colClasses=c('Date', 'Date'), header=TRUE)
recessions.trim = subset(recessions.df, Peak >= min(gspc.df$date))
g.gspc = ggplot(data = dfm) + geom_line(aes(x = Date, y = GSPCM, colour = "blue")) + geom_line(aes(x = Date, y = BIDM, colour = "red")) + geom_line(aes(x = Date, y = INDPROM, colour = "green")) + theme_bw()
g.gspc = g.gspc + geom_rect(data=recessions.trim, aes(xmin=Peak, xmax=Trough, ymin=-Inf, ymax=+Inf), fill='pink', alpha=0.4)
plot(g.gspc)

Here the following error message is returned:
Don't know how to automatically pick scale for object of type yearmon. Defaulting to continuous. Fehler: Discrete value supplied to continuous scale

I assume it has something to do with the date format in my dataframe and the date format in the recessions.df. Again, your help would be highly appreciated. Hope the code is not too lengthy.
P.S. If there is a way to generate the same chart including recession bars with the ChartSeries Tool from Quantmod, that would be awesome...

A: There is functionality for directly handling yearmon axes in the development version of zoo (update: now released as part of zoo 1.7-10):
library(zoo) # 1.7-10 or higher required
library(ggplot2)
library(scales)

z <- zoo(1:12, Sys.yearmon() + 1:12/12)
autoplot(z) + scale_x_yearmon()

scale_x_yearmon has a format argument which takes the usual percent codes.
UPDATE: scale_x_yearmon has now been released.

A: Your current setup will work if you convert the Date from yearmon to Date before plotting.
dfm = data.frame(Date = as.Date(gspcm.df$date), GSPCM = gspcm.df$GSPC.Adjusted,
    BIDM = sothebysm.df$BID.Adjusted, INDPROM = indprom.df$INDPRO.Close)


text:
Q: how to update url, but not render new view or component i want to make a dynamic url for my e-ticket website using vuejs 2
expectating url like this
https://e-tickets.com/movies/{movie-title}-{movie-id}

example
https://e-tickets.com/movies/black-panter-1203

UPDATE
so i have a flow like this

*

*when user click movie, it will push a url like this "e-ticket.com/movies/1203" first.

*after render a view component, my page will hit an API to get movie detail (inc title, synopsis, etc), and parameter/payload API from movie id in URL

*after that, API return a response. After get the response, router will change url like this "e-ticket.com/movie/black-panther-1203" but not reload page or something. just replace old url to new url like that


text:
Q: how to handle Multiple file upload using spring I am a newbie to spring and mvc framework.
I am going through the framwork and i wanted to understand the File upload (multiple) and use spring to load my complex object.
I have seen example using MultiPartFile for single file upload.
I tried the same for trying out the multiple file upload but I failed where i tried to make generic (like allowing the user to upload as many files).
Is there a way to do it in a optimal way to have the files available as list in the controller?
Thank you for reading!!!
is there a way to handle this without using multipart resolver?

A: Take a look at my answer to a similar question here:
Preserving value for <form:input type="file"> with Spring MVC
This explains our approach of an asynchronous file upload handling and processing of them on a final form submit.

A: I have used jquery.form.js.  You can find example using Google. If not you can tell me to post a link. Moreover you should investigate how the browsers will handle the upload process (i.e.


text:
Q: What validation and sanitization do I need on my graphql server? My server is using the following technologies: Node.js, Express, GraphQL, JWT, MongoDB, Mongoose
Currently, I just have users, with the ability to create, delete, update, and log in to accounts, as well as view all users' usernames, useful for search.
For authentication, I'm using JWT, Hashed passwords, and using middleware to verify the tokens and provide users' information into graphql context for use by my resolvers.
I understand that I need security at multiple levels, so I'll outline what I have and maybe you guys can guide me in the direction of what I'm missing.
Mongoose: Default type validators, required, etc.
Mongoose-validator: custom validators

*

*Full Name: Characters, hyphens, spaces, apostrophes only

*Username: alphanumeric, underscore, hyphen and period only, between 4 and 24 chars

*Email: Valid email using mongoose-validator isEmail validator

*Password: 8+ characters, at least one lowercase, uppercase, number

*Birthday: is a date object and is at least 18 years in the past.

My specific questions are:

*

*Do I need to use express-sanitizer with this? If so, will it affect special characters in passwords?

*Am I missing any specific type of validation, or is there a checklist for what I should be doing to protect my server?

Also, any recommendations would be appreciated!


text:
Q: Removing LaunchScreen.xib from a project Is it safe to remove LaunchScreen.xib from Xcode 6 project when is not used i.e. Images.xcassets is used instead ?
What is the proper way to remove it ? There is a property in info.plist called Launch screen interface file base name with value LaunchScreen so I guess that should be removed also?
Are there any more associated files with LaunchScreen.xib in Xcode 6 project which should be removed if LaunchScreen.xib is deleted?

A: Yes, it's safe. Just select the file in the XCode, press delete and choose "Move to Trash". The property in the .plist wil be automatically modified.

A: This answer resolve my issue:
You can do it by changing the "Launch Screen file" under your target settings on the General tab, Check this link:
http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/


text:
Q: Dialog box issue on android I am loading the data using http connection,when it does i am using progress dialog box.
The problem is when i press the hardware back button , dialog box is removed before loading all the data,but data is showed successfully,
the code for back button is i have used is,
   public boolean onKeyDown(int keyCode, KeyEvent event)
  {
    if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)
    {

        return true;
    }

    return super.onKeyDown(keyCode, event);
}

    public void onBackPressed()
    {

        return;
    }

A: You could use progressBar.setCancelable(false);
From the docs:
setCancelable(boolean flag)
Sets whether this dialog is cancelable with the BACK key.


text:
Q: How can I Connect a Postgres Schema in Nodejs and Switching Schemas Dynamically Using Sequelize? I have to connect to a Postgres database in Node.js and I want to switch schemas dynamically Using Sequelize Library.
Here is my Table Model and Controller Code.
    module.exports = function (sequelize, DataTypes) {
    const customer = sequelize.define(
        'customer',
        {
            id: {
                autoIncrement: true,
                primaryKey: true,
                type: DataTypes.INTEGER,
            },
            schema_name: {
                type: DataTypes.STRING,
                allowNull: false,
            },
            created_on: {
                type: DataTypes.DATE,
                allowNull: false,
                defaultValue: DataTypes.NOW(),
            },
        },
        {
            schema: 'public',
        }
    )
    return customer
}

And Controller Code
    exports.login = async (req, res, next) => {
        const { email, password, domain } = req.body
        const domainData = await customer.findOne({
             where: { schema_name: domain },
        })
        console.log('Log: exports.login -> domainData', domainData)
}

Once the response received I have to Switch Schemas Dynamically according to the above result.
Help me Guys Please

A: I resolved the problem using sequelize.query() function.
for getting Domain...
    const domainData = await sequelize.query(
    `SELECT schema_name from public.customer_management_client where schema_name = '${domain}'`
)

for switching to dynamic schema
const UserData = await sequelize.query(
            `SELECT * from ${domainData[0][0].schema_name}.user_access_user where email = '${email}'`
        )


text:
Q: Dual monitor display I have a NVidia FX580. I'm using the DVI-A (analog) for the first screen. I want to hook up a second screen. The second monitor is a Samsung SyncMaster 2220WM, can  I hook this monitor up to my graphics card?

A: yes you can. you will have two screens so statement "2 of 3" is true

Digital Outputs:  3 ( 2 out of 3 active at a time )
Analog Outputs:   1

says nvidia specs. and monitor specs say:

Input Connectors: 15-pin D-sub, DVI-D

all you need is cable


text:
Q: Is there a way to block copy/paste from textview? i need a way to deactivate the auto selection from a UITextView.

I deselected all the attributes from interface builder, but when i touch the text, the selection appear!
Have a solution? A magick tricks?
thanks.

A: You need to create a subclass of UITextView and override the canPerformAction method.
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
    if (action == @selector(copy:)
        return NO;
    return [super canPerformAction:action withSender:sender];
}

The selector values you can expect from canPerformAction can be found in the UIResponderStandardEditActions Protocol Reference
The UIResponder Class Reference will help as well.

canPerformAction:withSender:
This default implementation of this
method returns YES if the responder
class implements the requested action
and calls the next responder if it
does not. Subclasses may override this
method to enable menu commands based
on the current state; for example, you
would enable the Copy command if there
is a selection or disable the Paste
command if the pasteboard did not
contain data with the correct
pasteboard representation type. If no
responder in the responder chain
returns YES, the menu command is
disabled.

A: Look at UIResponder Class Reference
So create a subclass of UITextView that overrides the canPerformAction:withSender: method and return 'NO' for every action that you don't want to perform on textview.


text:
Q: Problems with javascript function call I am using the YUI Progress Bar but I'm having some problems with it.
Normally to change the value of the progress bar, one would use:
progressBar.set('value', 10000);
Where value is the thing I am trying to change and 10000 is what I want to change it to. In the console, this returns true
That works fine. But I want to pass a variable as the value:
progressBar.set('value', total);
But this is not working for me and the console reports false
Here is the code:
This creates and renders the bar:
var progressBar = new YAHOO.widget.ProgressBar({
                direction: "ttd",
                height: "75px",
                width: "750px",
                anim: true,
                minValue: 0,
                maxValue: 85000,
                value: 35000
            }).render("bar");

            var anim = progressBar.get('anim');
            anim.duration = 3;
            anim.method = YAHOO.util.Easing.bounceBoth;

And this is an ajax request to get the value that I would like to set the bar to:
var itemTotal, mITotal, donationTotal, total;

            function showHint()
            {
            var xmlhttp;
            if (window.XMLHttpRequest)
              {// code for IE7+, Firefox, Chrome, Opera, Safari
              xmlhttp=new XMLHttpRequest();
              }
            else
              {// code for IE6, IE5
              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
            xmlhttp.onreadystatechange=function()
              {
              if (xmlhttp.readyState==4 && xmlhttp.status==200)
                {
                var myString = new String(xmlhttp.responseText);
                var myArray = myString.split(',');
                itemTotal = myArray[0];
                mITotal = myArray[1];
                donationTotal = myArray[2];
                total = myArray[3];

                progressBar.set('value', total);
                alert(total);
                }
              }
            xmlhttp.open("GET","goal_ajax.php",true);
            xmlhttp.send();
            }

Any ideas?

A: This:
                var myArray = myString.split(',');
                ...
                total = myArray[3];

doesn't set total to 10000 (a number), but to '10000' (a string). I'm betting that if you were to try
                progressBar.set('value', '10000');

you'd see the same problem. To fix this, change this:
                total = myArray[3];

to this:
                total = +myArray[3];

which will convert the '10000' into 10000.
(Disclaimer: not tested. This is just a guess, but as guesses go, I'm pretty confident of it.)


text:
Q: MPDF does not show table borders or anything related to table, just data I just need the simplest workaround way or at least reason why it does not work
I already figured out that bootstrap does not work with MPDF, so wrote a simplest piece of regular html code. But still, no table is being shown.
 <?php
    require_once __DIR__ . '/vendor/autoload.php';

    $mpdf = new \Mpdf\Mpdf();

  //html variable

  $data= '<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-
    scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

//A Simple table

     ID

 2413134

  ';

//outputing from here
$mpdf->WriteHTML($data);

$mpdf->Output();
?>

A: Try to add a border via css:
td {
    border: 1px solid;
}


text:
Q: HtmlAgilityPack HtmlDocument access head element How do we access the head element in HtmlAgilityPack?
We have this code :
var doc = new HtmlDocument();

but when trying to get the head element
var head = doc.DocumentNode.SelectSingleNode("//head");

result is head is null


text:
Q: Android: Get bitmap/drawable from HTTPS I want to get an image from a server (HTTPS) and show it in an ImageView.
Images are from Facebook Events (example: https://fbcdn-photos-f-a.akamaihd.net/hphotos-ak-prn1/c17.0.50.50/1016204_538791999501573_1791760778_t.jpg )
 Drawable.createFromStream((InputStream)new URL("https://fbcdn-photos-f-a.akamaihd.net/hphotos-ak-prn1/c17.0.50.50/1016204_538791999501573_1791760778_t.jpg").getContent(), "src");

throws NullPointer Exception
Or maybe is there any way to get the image via Facebook SDK?
In Facebook SDK I only know the ProfilePictureView (which may only be for profile pictures???)
Thanks so far!

A: have You check internet permission?
<uses-permission android:name="android.permission.INTERNET" />

or user LazyLoading. so you can have cache stored in sdcard and next time you can get image quickly. so use example of this
http://www.androidhive.info/2012/07/android-loading-image-from-url-http/
or use another method
public static Bitmap getBitmapFromURL(String src) {
    try {
        Log.e("src",src);
        URL url = new URL(src);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setDoInput(true);
        connection.connect();
        InputStream input = connection.getInputStream();
        Bitmap myBitmap = BitmapFactory.decodeStream(input);
        Log.e("Bitmap","returned");
        return myBitmap;
    } catch (IOException e) {
        e.printStackTrace();
        Log.e("Exception",e.getMessage());
        return null;
    }
}

A: Check <uses-permission android:name="android.permission.INTERNET" />
And I recommend look his:
Android - Loading Image Url and Displaying in ImageView

A: i recommend you to implement this into your project. It's the best solution.
https://github.com/thest1/LazyList

A: I'm such a dumbass :D
Everything of your answers were right!!!
I displayed the ImageView in a dialog.
I used the following to point to the ImageView
ImageView image = (ImageView)findViewById(R.id.imageView_event_picture);

but for sure this is NULL in a dialog!
It has to be
( final Dialog dialog = new Dialog(EventActivity.this); )

ImageView image = (ImageView)dialog.findViewById(R.id.imageView_event_picture);

I didn't mention that I'm running it out of a dialog - Sorry!!


text:
Q: Relation between free resolutions and minimal free resolutions Let $(R,\mathfrak{m},k)$ a Noetherian local ring and $M$ a finitely generated $R$-module. In this case, given $F_{\bullet}$ a free resolution of $M$, what is the relation between $F_{\bullet}$ and a minimal free resolution $G_{\bullet}$ of $M$?
In this paper
https://projecteuclid.org/journals/illinois-journal-of-mathematics/volume-44/issue-3/Betti-numbers-of-almost-complete-intersections/10.1215/ijm/1256060413.full
Dugger says that we can decompose $F_{\bullet}$ into $G_{\bullet} \oplus Q_{\bullet}$ where $Q_{\bullet}$ is a split exact resolution of zero. I'm new in this area. How I can make this decomposition?

A: The proof is based on the following observation: If $A \in \mathrm{M}_{n,m}(R)$ is an $n \times m$ matrix with coefficients $a_{ij}$ such that there exists indices $i,j$ where $a_{ij}$ is a unit, then there exist $B \in \mathrm{GL}_n(R)$ and $C \in \mathrm{GL}_m(R)$ such that
$$
B A C = \begin{bmatrix}
1 & 0 & \dots & 0 \\
0 & * & \dots & * \\
\vdots & \vdots & \ddots & \vdots \\
0 & * & \dots & *
\end{bmatrix}.
$$
To find $B$ and $C$ you simply reorder your basis and then perform Gaussian row and column elimination. Now we have a commutative diagram
$\require{AMScd}$
\begin{CD}
R^m @>A>> R^n\\
@V C^{-1} V V @VV B V\\
R \oplus R^{m - 1} @>>1 \oplus A'> R \oplus R^{n - 1}
\end{CD}
where $A'$ is the lower right block in $B A C$.
Recall that a free resolution $$F_i \xrightarrow{A_i} F_{i-1} \to \dots \xrightarrow{A_1} F_0 \xrightarrow{} M$$ is minimal if and only if all the coefficients of the matrices $A_i$ are contained in $\mathfrak{m}$. If the resolution is not minimal, there exists some matrix coefficient which is not in $\mathfrak{m}$. Since $R$ is local, this coefficient will be a unit and we can apply the above to write
$$
F_\bullet \cong F_\bullet' \oplus (R[l] \xrightarrow{1} R[l - 1])
$$
for some shift $l$.
If $F_\bullet'$ is not minimal we inductively continue until we reach a minimal complex $G_\bullet$. Now $F_\bullet \cong G_\bullet \oplus Q_\bullet$, where $Q_\bullet$ is a direct sum of shifts of $R \xrightarrow{1} R$.


text:
Q: Accessing 2D array values using a pointer I need to take a 2d array (Grid) from stdin, do some manupulation to the chars and print a new grid with the changes.
My strategy was to make a Struc with a Grid grid[LINES][COLUMNS] then use getChar() to push each char into grid using a pointer. It work great when I print within the function but I can't acces the values from outside. I am only getting weird characters that probably represent memory adress or something.
Here is a simplified code block of the program.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>

struct Grid{
    char box[20][40];
};

int main(int argc, char *argv[]) {
    struct Grid grid;

    readInitGrid(&grid);
    displayGrid(&grid);

}

void readInitGrid(struct Grid *grid) {
  char c;
  for (unsigned int i = 0; i < 20; i++) {
    for (unsigned int j = 0; j < 40 + 1; j++) { //+1 is for the /n at the end of each line
      while ((c = getchar()) != EOF) {
        grid->box[i][j] = c;
        printf("%c", grid->box[i][j]);     //Will print correcly
      }
    }
  }
}

void displayGrid(const struct Grid *grid) {
  for (unsigned int i = 0; i < 20; ++i) {
      for (unsigned int j = 0; j < 40; ++j) {
          printf("%c", grid.box[i][j]);       //This do not work
      }
  }
  printf("\n");
}

Result - See both print block bellow First block show perfectly but second is messed-up
I am passing other things to this struct in the real program and I dont have any issu to acces the infomration for int and char. THe only one I am having issue with is 2d array. An other thing, I can't use maloc for this.

A: Changed the while to an if so that my for loop affect the grid->box[i][j] = c;
void readInitGrid(struct Grid *grid) {
  char c;
  for (unsigned int i = 0; i < 20; i++) {
    for (unsigned int j = 0; j < 40 + 1; j++) {
      if ((c = getchar()) != EOF) {
        grid->box[i][j] = c;
        printf("%c", grid->box[i][j]);
      }
    }
  }
}


text:
Q: "TypeError: obj.indexOf is not a function" error when writing a selenium test script I'm currently making an automated test script using Selenium Webdriver and Cucumber for my company's website. To do this I have used Matt-B's example as a start. Since getting the files, I modified the contents of google.feature to:
  Feature: Changing Pages
    As an internet user
    In order to move through a website
    I want to be able to click a button and go to another page

    Scenario: Digital3rd Testing page
      Given I am on the Digital3rd website
      When I click the "Testing" button
      Then I should go to "../testing"

And have now started modifying google-steps.js to this:
'use strict';

var expect = require('chai').expect;

module.exports = function() {
  this.World = require('../support/world.js').World;

  this.Given(/^I am on the Digital(\d+)rd website$/, function (arg1, callback) { //declaring function that relates to Cucumber Script
        this.driver.get('http://www.Digital3rd.org'); //open intended website
    callback(null, 'set-up');
  });

  this.When(/^I click the "([^"]*)" button$/, function (arg1, callback) { //declaring function that relates to Cucumber Script
      this.onload = //when the page loads...
         this.driver.manage().window().maximize(); //maximise the screen...
         this.driver.findElement({id: 'menu-item-24'}).click(); //click the "Testing" button.
    callback(null, 'test');
  });

  this.Then(/^I should go to "([^"]*)"$/, function (promise) {
        var wbaddrss = this.driver.getCurrentUrl();
        return expect(wbaddrss).to.contain('/testing');
  });
};

The first two steps work fine by opening the website, maximising it and clicking the button. I'm now trying to validate that I am on the correct page using a section of the URL. Any help with fixing the "TypeError: obj.indexOf is not a function" error or with giving me an alternative would be appreciated thanks. Sorry if it's a simple answer but this is the first time I've done anything like this.
The full error code I get in the console is:
 TypeError: obj.indexOf is not a function
     at Assertion.include (C:\Users\User\Test program\node_modules\chai\lib\chai\core\assertions.js:228:45)
     at Assertion.assert (C:\Users\User\Test program\node_modules\chai\lib\chai\utils\addChainableMethod.js:84:49)
     at World.<anonymous> (C:\Users\User\Test program\features\step_definitions\google-steps.js:32:30)
     at nextTickCallbackWith0Args (node.js:420:9)
     at process._tickCallback (node.js:349:13)

A: I just ran into the same issue with expect(object).to.contain('string') in Chai and would like to step through it to find out what's going wrong.  Meanwhile, you can judiciously use JS regular expressions with the match() function rather than contain():
expect(object1).to.match(/String to contain/);
expect(object2).to.match(/^Exact string to match$/);

expect(object3).to.match(/^This string might contain other things/);
expect(object3).to.match(/before it ends here$/);

To use variables in the regex, see this other SO answer: https://stackoverflow.com/a/17886301/949911/

A: indexOf is Array Property and not of object


text:
Q: Invert Slider Control top MFC C++ I have a MFC project in which I use a Slider Control. When I set this slider to vertical, the upside is the lowest and the downside is the heigest. How can I invert this, so that the highest value is closest to the top of the screen and the lowest value is closesd to the bottom of the screen?

A: if you choose to set range from 0, 100  - then you have to position slider at position 100, and every time slider is moved, you must take 100 minus the slider position


text:
Q: How can I find the PPPoE password configured in Airport I'm connecting to internet via PPPoE with a AirPort Express. Now I want to replace AirPort with another router, but I don't remember the password of my PPPoE account. So I'm wondering how can I extract the password from the provisioned AirPort Express.

A: If your PPPoE is provided by your ISP, so contact you ISP's help is short way than try to extract the account info from AE's settings.


text:
Q: Set line width in OpenGL 3 / GLSL 130 I'm using a scene where wireframes are shown and where I want to set the width of the used lines to 2.
When I search for this problem, I only stumble upon glLineWidth()-function which seems to belong to old OpenGL 1.x
So: how can I set the width of wireframe lines when OpenGL3 / GLSL 130 is used?

A: Line width was never removed from OpenGL. It was deprecated, but in 3.1, when most of the deprecated features were removed, line width was not among them. So there's no reason you shouldn't be able to use it in OpenGL 3.1+ core profile.
Just don't create a "forward compatibility context", and you should be fine. Now yes, MacOS's OpenGL support doesn't let you create a 3.1+ context unless you declare it to be forward compatible. But MacOS deprecated OpenGL as a whole, so how long the API will be supported on that platform is unclear.


text:
Q: dynamically detect if textbox value is change Is it possible to detect the change of a textbox even if that textbox value is not entered by user like the below scenario? I have some scenarios like when the page is loading for the first time the texbox get loaded with data.

$("#txt1").change(function(){
  $("#txt2").val("1")
  //$("#txt2").change();
});

$('#txt2').on("change", function() {
  // some computation will happen here.
  alert("1");
});

$("#btn1").click(function(){
  $("#txt2").val("1");
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<input type="text" id="txt1">
<input type="text" id="txt2" name='text1'>
<button id="btn1">
    Click
</button>

A: The value changed by JavaScript does not trigger any event so you just can't catch event in this case.
You can implement a watcher to your input value using interval

var oldValue = $("#txt2").val();
setInterval(function() {
    var currentValue = $("#txt2").val();
    if (currentValue !== oldValue) {
      $("#txt2").trigger("change");
      oldValue = currentValue;
    }
}, 100);

$("#txt1").change(function(){
  $("#txt2").val("1")
});

$('#txt2').on("change", function() {
  // some computation will happen here.
  alert("1");
});

$("#btn1").click(function(){
  $("#txt2").val("1");
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<input type="text" id="txt1">
<input type="text" id="txt2" name='text1'>
<button id="btn1">
Click
</button>

A: As you know that on textbox1 change event you are changing second textbox value, you need to trigger it manually
$(document).ready(function () {

 $("#txt1").change(function () {

   $("#txt2").val("1")
   $("#txt2").trigger("change");

 });

 $("#txt2").change(function () {

    alert("1");

 });

})


text:
Q: Tarski's Theorem and Gödel's Second Incompleteness Theorem I (think) that I once heard it said that from Tarski's Theorem on the undecidability of truth, Gödel's Second Incompleteness Theorem follows. Is this right?

A: Tarski's theorem is on the unDEFINability of truth, but yes, Goedel's results follow (and in some sense are the same thing): provability (in some particular system of interest) is definable, therefore truth cannot match provability, therefore (supposing the system of interest is consistent, and therefore sound for the relevant sentences) there is a sentence which is true but not provable. This is the first completeness theorem.
What would it mean for a predicate T to actually define truth? Just that T(s) and s are equivalent for each sentence s. Thus, Tarski's undefinability theorem tells us more specifically that, for any definable T, there is some sentence G such that T(G) and G are equivalent to each other's negation. The above is just what happens when we take T to define provability; we thus see more specifically that incompleteness arises from a sentence G equivalent to the negation of its provability, which is therefore (supposing the system of interest is consistent) true but not provable.
One can then argue, in the usual way, that our proof of the first incompleteness theorem, suitably internalized in the system of interest, yields the second incompleteness theorem. [Our argument shows that the consistency of the system of interest entails the non-provability of G. But this conclusion is just what it means for G to be true! Thus, if the system of interest proves its own consistency, it proves G, contra its own consistency.]

A: I got some very exciting new ideas from the reply of Sridhar Ramesh, for which I am very thankful. The question has a negative answer:
(i) Tarski's Undefinability Theorem is not about any (particular) theory; it says that there is no formula $\Psi(x)$ such that for any formula $\varphi$ can $\mathbb{N}\models \varphi \leftrightarrow \Psi(\overline{\varphi})$ hold. While Gödel's Second Incompleteness Theorem is about some theory $T$ for which
(A) $\qquad T\nvdash\textsf{Con}(T)$
holds for some "consistency predicate" $\textsf{Con}(-)$.
(ii) To make more sense of the question, let me formalize Tarski's Undefinability Theorem for a theory $T$ as follows:
(B) $\qquad \neg \exists \Psi\; \forall \varphi\; T\vdash \varphi\leftrightarrow \Psi(\overline{\varphi})$
Now, "some clever argument or other" should prove (B)$\Longrightarrow$(A), right?
The negative answer comes from a result of Dan E. Willard (http://dx.doi.org/10.1016/j.apal.2005.12.010 or http://www.jstor.org/stable/2695030) that for some (very weak and) consistent theory $S$ we can have $S\vdash\textsf{Con}(S)$.
Proof (of our claim):
 So, the theory $S$ does not satisfy (A). But it satisfies (B) since for an extension of $S$, say $\textsf{PA}$, the Diagonal Lemma holds. Thus, for any $\Psi(x)$ there exists some $\theta$ such that $\textsf{PA}\vdash \theta\leftrightarrow\neg\Psi(\overline{\theta})$ or equivalently $\textsf{PA}\vdash\neg\big[\theta\leftrightarrow\Psi(\overline{\theta})\big]$ (noting the propositional tautology $\neg(p\leftrightarrow q)\equiv p\leftrightarrow\neg q$) which implies that $S\nvdash\theta\leftrightarrow\Psi(\overline{\theta})$.
$\texttt{QED}$
Therefore, Tarski's Undefinability Theorem does not imply Gödel's Second Incompleteness Theorem. Even though, as was noted in the replies, there are some vivid connections between the two. For some computational connections I invite consulting (https://arxiv.org/abs/1509.00164).


text:
Q: Javascript regex for specific name validation I have a university assignment to write a JS regex for name validation: name can include spaces at the beginning and the end (don't ask anything, it's our teacher demand), also it can include such chars like: -, ' and space (" "). At the moment, my regex looks like that:
var Nameregex = /^( ?)*[A-Z]+((['-])?[a-z]+)*(([ ]?[a-z]*)*)*$/g;

It works almost perfect, but except for one case: one word (words separated from each other with spaces and - symbols) can contain only one ' symbol.
For example, names like John-andrew'andrew'john shouldn't work. But John-andrew'john-andrew'john should work.

A: Add a (?!.*'[A-Za-z]+') negative lookahead after ^:
/^(?!.*'[A-Za-z]+')\s*[A-Z]+(?:['-]?[a-z]+)*(?:\s*[a-z]*)*$/

See proof
Explanation
--------------------------------------------------------------------------------
  ^                        the beginning of the string
--------------------------------------------------------------------------------
  (?!                      look ahead to see if there is not:
--------------------------------------------------------------------------------
    .*                       any character except \n (0 or more times
                             (matching the most amount possible))
--------------------------------------------------------------------------------
    '                        '\''
--------------------------------------------------------------------------------
    [A-Za-z]+                any character of: 'A' to 'Z', 'a' to 'z'
                             (1 or more times (matching the most
                             amount possible))
--------------------------------------------------------------------------------
    '                        '\''
--------------------------------------------------------------------------------
  )                        end of look-ahead
--------------------------------------------------------------------------------
  \s*                      whitespace (\n, \r, \t, \f, and " ") (0 or
                           more times (matching the most amount
                           possible))
--------------------------------------------------------------------------------
  [A-Z]+                   any character of: 'A' to 'Z' (1 or more
                           times (matching the most amount possible))
--------------------------------------------------------------------------------
  (?:                      group, but do not capture (0 or more times
                           (matching the most amount possible)):
--------------------------------------------------------------------------------
    ['-]?                    any character of: ''', '-' (optional
                             (matching the most amount possible))
--------------------------------------------------------------------------------
    [a-z]+                   any character of: 'a' to 'z' (1 or more
                             times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
  )*                       end of grouping
--------------------------------------------------------------------------------
  (?:                      group, but do not capture (0 or more times
                           (matching the most amount possible)):
--------------------------------------------------------------------------------
    \s*                      whitespace (\n, \r, \t, \f, and " ") (0
                             or more times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
    [a-z]*                   any character of: 'a' to 'z' (0 or more
                             times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
  )*                       end of grouping
--------------------------------------------------------------------------------
  $                        before an optional \n, and the end of the
                           string