Erro ao alterar modelo de aplicação C# asp.net

Question: Precisei alterar uma aplicação feita há algum tempo atrás em C# asp.net. Acrescentei a coluna no banco de dados que precisava e quando acrescento no model o campo correspondente, ao rodar a aplicação ela já não me identifica como usuário. (A aplicação usa windows authentication)
E ao entrar em qualquer menu da aplicação, me retorna o seguinte erro:
As informações de mapeamento e de metadados do EntityContainer 'Context' não correspondem mais às informações usadas para criar as exibições pré-geradas.
O que eu preciso fazer para conseguir mexer na aplicação e acrescentar os novos campos que preciso ? Foi usado CodeFirst na criação da aplicação.
EDIT
Ao executar o comando Enable-Migration foi criada em minha aplicação uma pasta com o nome Migration com a seguinte configuração:
namespace GAWeb.WebApp.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;

internal sealed class Configuration : DbMigrationsConfiguration</* TODO: put your Code     First context type name here */DbContext>
{
    public Configuration()
    {
        AutomaticMigrationsEnabled = false;

    }

        protected override void Seed(/* TODO: put your Code First context type name here */ )
   {

            ...

    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataIntegration.Model.Entities;

namespace DataIntegration.Model.Repositories
{
public interface IUnitOfWork : IDisposable
{
    IRepository<IAccount> Accounts { get; }
    IRepository<IBudget> Budgets { get; }
    IRepository<IEmployee> Employees { get; }
    IRepository<IInvoice> Invoices { get; }
    IRepository<IItem> Items { get; }
    IRepository<IRequest> Requests { get; }
    IRepository<IRequestHistory> RequestsHistory { get; }
    IRepository<IRequestItem> RequestItems { get; }
    IRepository<IResultCenter> ResultCenters { get; }
    IRepository<IUnit> Units { get; }
    void Save();
    void Dispose(bool disposing);
}
}

namespace GAWeb.VoucherRequests.Model.Repositories
{
public class UnitOfWork : IUnitOfWork
{
    private Context context = new Context();
    private GenericRepository<Employee> employees;
    private GenericRepository<Invoice> invoices;
    private GenericRepository<Voucher> items;
    private GenericRepository<Request> requests;
    private GenericRepository<RequestHistory> requestsHistory;
    private GenericRepository<RequestItem> requestItems;
    private GenericRepository<ResultCenter> resultCenters;
    private GenericRepository<Unit> units;

        public IRepository<Unit> Units
    {
        get
        {
            if (units == null)
                units = new GenericRepository<Unit>(context);
            return units;
        }
    }

    IRepository<IEmployee> IUnitOfWork.Employees { get { return Employees as IRepository<IEmployee>; } }

    IRepository<IInvoice> IUnitOfWork.Invoices { get { return Invoices as IRepository<IInvoice>; } }

    IRepository<IItem> IUnitOfWork.Items { get { return Items as IRepository<IItem>; } }

    IRepository<IRequest> IUnitOfWork.Requests { get { return Requests as IRepository<IRequest>; } }

    IRepository<IRequestHistory> IUnitOfWork.RequestsHistory { get { return RequestsHistory as IRepository<IRequestHistory>; } }

    IRepository<IRequestItem> IUnitOfWork.RequestItems { get { return RequestItems as IRepository<IRequestItem>; } }

    IRepository<IResultCenter> IUnitOfWork.ResultCenters { get { return ResultCenters as IRepository<IResultCenter>; } }

    IRepository<IUnit> IUnitOfWork.Units { get { return Units as IRepository<IUnit>; } }

Essa é a Entitites que eu quero alterar:
using System;

namespace DataIntegration.Model.Entities
{
public interface IRequestItem : IEntity
{
    int Id { get; set; }

    DateTime? Date { get; set; }
    DateTime Data_Retorno { get; set; } // Esse é um campo que quero acrescentar a aplicação e ao banco
    int Quantity { get; set; }

    string Employee_Id { get; set; }
    IEmployee Employee { get; set; }
    string Unit_Id { get; set; }
    IUnit Unit { get; set; }
    string ResultCenter_Id { get; set; }
    IResultCenter ResultCenter { get; set; }
    int TaxiRequest_Id { get; set; }
    IRequest Request { get; set; }
}

}
Classe Context
public class Context : DbContext, IDisposable
{
    public Context()
        : base(DatabaseInfo.CONNECTION_STRING)
    {
        Configuration.ValidateOnSaveEnabled = false;
    }

    public bool Validate<T>(T entity) where T : class
    {
        return ValidateEntity(Entry(entity), null).IsValid;
    }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);

        //TABLE MAPS
        modelBuilder.Entity<Unit>().ToTable(DatabaseInfo.UNITS_TABLE);
        modelBuilder.Entity<ResultCenter>().ToTable(DatabaseInfo.CENTERS_TABLE);
        modelBuilder.Entity<Employee>().ToTable(DatabaseInfo.EMPLOYEES_TABLE);
        modelBuilder.Entity<Request>().ToTable(DatabaseInfo.TAXI_REQUEST_TABLE);
        modelBuilder.Entity<Voucher>().ToTable(DatabaseInfo.VOUCHERS_TABLE);
        modelBuilder.Entity<RequestItem>().ToTable(DatabaseInfo.REQUEST_ITEM_TABLE);
        modelBuilder.Entity<Invoice>().ToTable(DatabaseInfo.TAXI_INVOICE_TABLE);
        modelBuilder.Entity<RequestHistory>().ToTable(DatabaseInfo.REQUEST_HISTORY_TABLE);

  }

    public DbSet<Invoice> Invoices { get; set; }
}
}

Generic Repository
namespace GAWeb.VoucherRequests.Model.Repositories
{
public class GenericRepository<TEntity> : IRepository<TEntity> where TEntity : class, IEntity
{
    private Context context;
    private DbSet<TEntity> dbSet;

    public GenericRepository(Context context)
    {
        this.context = context;
        this.dbSet = context.Set<TEntity>();
    }

    public virtual bool IsValid(TEntity entity)
    {
        return context.Validate(entity);
    }

    public virtual IEnumerable<TEntity> Get(
         Expression<Func<TEntity, bool>> filter = null,
         Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
        params string[] includeProperties)
    {
        IQueryable<TEntity> query = dbSet;

        if (filter != null)
        {
            query = query.Where(filter);
        }

        foreach (var includeProperty in includeProperties)
        {
            query = query.Include(includeProperty);
        }

        if (orderBy != null)
        {
            return orderBy(query).ToList();
        }
        else
        {
            return query.ToList();
        }
    }

    public virtual TEntity GetByID(object id)
    {
        return dbSet.Find(id);
    }

    public virtual TEntity GetLoadedByID(object id)
    {
        return dbSet.Local.Single(x => x.Id.Equals(id));
    }

    public virtual void Insert(TEntity entity)
    {
        dbSet.Add(entity);
    }

    public virtual void Delete(object id)
    {
        TEntity entityToDelete = dbSet.Find(id);
        Delete(entityToDelete);
    }

    public virtual void Delete(TEntity entityToDelete)
    {
        if (context.Entry(entityToDelete).State == EntityState.Detached)
        {
            dbSet.Attach(entityToDelete);
        }
        dbSet.Remove(entityToDelete);
    }

    public virtual void Update(TEntity entityToUpdate)
    {
        dbSet.Attach(entityToUpdate);
        context.Entry(entityToUpdate).State = EntityState.Modified;
    }

    public void Clear()
    {
        throw new NotImplementedException();
    }
}

}
Context.Views
//------------------------------------------------------------------------------
// <auto-generated>
//     O código foi gerado por uma ferramenta.
//     Versão de Tempo de Execução:4.0.30319.544
//
//     As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas  se
//     o código for gerado novamente.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly:  System.Data.Mapping.EntityViewGenerationAttribute(typeof(Edm_EntityMappingGeneratedViews.ViewsForBaseEntitySets7F3AFE99A19115C1600A2D3407EFC3D1F36FBA78AF0470677E19E4A993E04F7B))]

namespace Edm_EntityMappingGeneratedViews
{

///
/// O tipo contém exibições para EntitySets e AssociationSets que foram gerados em tempo de design.
///
public sealed class ViewsForBaseEntitySets7F3AFE99A19115C1600A2D3407EFC3D1F36FBA78AF0470677E19E4A993E04F7B : System.Data.Mapping.EntityViewContainer
{

    ///
    /// O construtor armazena as exibições para as extensões e também os valores de hash gerados com base nos metadados e no fechamento e nas exibições do mapeamento.
    ///
    public ViewsForBaseEntitySets7F3AFE99A19115C1600A2D3407EFC3D1F36FBA78AF0470677E19E4A993E04F7B()
    {
        this.EdmEntityContainerName = "Context";
        this.StoreEntityContainerName = "CodeFirstDatabase";
        this.HashOverMappingClosure = "edf2b152bf40e88b95f3411ab7b29fa2627c7224d571c8d9557eef38c0f29386";
        this.HashOverAllExtentViews = "10a3551ac384c60e8d31d44333d96794897a405b3f595947069bdd8f21e80060";
        this.ViewCount = 16;
    }

    ///
    /// O método retorna a exibição do índice fornecido.
    ///
    protected override System.Collections.Generic.KeyValuePair<string, string> GetViewAt(int index)
    {
        if ((index == 0))
        {
            return GetView0();
        }
        if ((index == 1))
        {
            return GetView1();
        }
        if ((index == 2))
        {
            return GetView2();
        }
        if ((index == 3))
        {
            return GetView3();
        }
        if ((index == 4))
        {
            return GetView4();
        }
        if ((index == 5))
        {
            return GetView5();
        }
        if ((index == 6))
        {
            return GetView6();
        }
        if ((index == 7))
        {
            return GetView7();
        }
        if ((index == 8))
        {
            return GetView8();
        }
        if ((index == 9))
        {
            return GetView9();
        }
        if ((index == 10))
        {
            return GetView10();
        }
        if ((index == 11))
        {
            return GetView11();
        }
        if ((index == 12))
        {
            return GetView12();
        }
        if ((index == 13))
        {
            return GetView13();
        }
        if ((index == 14))
        {
            return GetView14();
        }
        if ((index == 15))
        {
            return GetView15();
        }
        throw new System.IndexOutOfRangeException();
    }

    ///
    /// exibição de retorno para CodeFirstDatabase.Invoice
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView0()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Invoice", @"
SELECT VALUE -- Constructing Invoice
    [CodeFirstDatabaseSchema.Invoice](T1.Invoice_Id, T1.Invoice_Code, T1.Invoice_Date, T1.Invoice_Value, T1.Invoice_Discount)
FROM (
    SELECT
        T.Id AS Invoice_Id,
        T.Code AS Invoice_Code,
        T.Date AS Invoice_Date,
        T.[Value] AS Invoice_Value,
        T.Discount AS Invoice_Discount,
        True AS _from0
    FROM Context.Invoices AS T
) AS T1");
    }

    ///
    /// exibição de retorno para CodeFirstDatabase.Voucher
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView1()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Voucher", @"
SELECT VALUE -- Constructing Voucher
    [CodeFirstDatabaseSchema.Voucher](T1.Voucher_Id, T1.Voucher_Code, T1.Voucher_Purpose, T1.Voucher_Date, T1.Voucher_Value, T1.Voucher_AdjustedValue, T1.Voucher_Status, T1.Voucher_Note, T1.[Voucher.Employee_Id], T1.[Voucher.Request_Id], T1.[Voucher.Unit_Id], T1.[Voucher.ResultCenter_Id], T1.[Voucher.Invoice_Id])
FROM (
    SELECT
        T.Id AS Voucher_Id,
        T.Code AS Voucher_Code,
        T.Purpose AS Voucher_Purpose,
        T.Date AS Voucher_Date,
        T.[Value] AS Voucher_Value,
        T.AdjustedValue AS Voucher_AdjustedValue,
        T.Status AS Voucher_Status,
        T.Note AS Voucher_Note,
        T.Employee_Id AS [Voucher.Employee_Id],
        T.Request_Id AS [Voucher.Request_Id],
        T.Unit_Id AS [Voucher.Unit_Id],
        T.ResultCenter_Id AS [Voucher.ResultCenter_Id],
        T.Invoice_Id AS [Voucher.Invoice_Id],
        True AS _from0
    FROM Context.Vouchers AS T
) AS T1");
    }

    ///
    /// exibição de retorno para CodeFirstDatabase.Employee
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView2()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Employee", @"
SELECT VALUE -- Constructing Employee
    [CodeFirstDatabaseSchema.Employee](T1.Employee_Id, T1.Employee_Name, T1.Employee_Active)
FROM (
    SELECT
        T.Id AS Employee_Id,
        T.Name AS Employee_Name,
        T.Active AS Employee_Active,
        True AS _from0
    FROM Context.Employees AS T
) AS T1");
    }

    ///
    /// exibição de retorno para CodeFirstDatabase.Request
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView3()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Request", @"
SELECT VALUE -- Constructing Request
    [CodeFirstDatabaseSchema.Request](T1.Request_Id, T1.Request_Date, T1.Request_Justification, T1.Request_Note, T1.Request_Processed, T1.[Request.Employee_Id])
FROM (
    SELECT
        T.Id AS Request_Id,
        T.Date AS Request_Date,
        T.Justification AS Request_Justification,
        T.Note AS Request_Note,
        T.Processed AS Request_Processed,
        T.Employee_Id AS [Request.Employee_Id],
        True AS _from0
    FROM Context.Requests AS T
) AS T1");
    }

    ///
    /// exibição de retorno para CodeFirstDatabase.RequestHistory
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView4()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.RequestHistory", @"
SELECT VALUE -- Constructing RequestHistory
    [CodeFirstDatabaseSchema.RequestHistory](T1.RequestHistory_Id, T1.RequestHistory_Date, T1.[RequestHistory.Request_Id], T1.[RequestHistory.Item_Id], T1.[RequestHistory.Employee_Id], T1.[RequestHistory.Unit_Id], T1.[RequestHistory.ResultCenter_Id])
FROM (
    SELECT
        T.Id AS RequestHistory_Id,
        T.Date AS RequestHistory_Date,
        T.Request_Id AS [RequestHistory.Request_Id],
        T.Item_Id AS [RequestHistory.Item_Id],
        T.Employee_Id AS [RequestHistory.Employee_Id],
        T.Unit_Id AS [RequestHistory.Unit_Id],
        T.ResultCenter_Id AS [RequestHistory.ResultCenter_Id],
        True AS _from0
    FROM Context.RequestHistories AS T
) AS T1");
    }

    ///
    /// exibição de retorno para CodeFirstDatabase.Unit
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView5()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Unit", @"
SELECT VALUE -- Constructing Unit
    [CodeFirstDatabaseSchema.Unit](T1.Unit_Id, T1.Unit_Code, T1.Unit_Name, T1.Unit_Manager, T1.Unit_Description, T1.Unit_Year, T1.Unit_Level, T1.Unit_Type, T1.[Unit.Parent_Id])
FROM (
    SELECT
        T.Id AS Unit_Id,
        T.Code AS Unit_Code,
        T.Name AS Unit_Name,
        T.Manager AS Unit_Manager,
        T.Description AS Unit_Description,
        T.Year AS Unit_Year,
        T.Level AS Unit_Level,
        T.Type AS Unit_Type,
        T.Parent_Id AS [Unit.Parent_Id],
        True AS _from0
    FROM Context.Units AS T
) AS T1");
    }

    ///
    /// exibição de retorno para CodeFirstDatabase.ResultCenter
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView6()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.ResultCenter", @"
SELECT VALUE -- Constructing ResultCenter
    [CodeFirstDatabaseSchema.ResultCenter](T1.ResultCenter_Id, T1.ResultCenter_Code, T1.ResultCenter_Name, T1.ResultCenter_Description, T1.ResultCenter_Year, T1.ResultCenter_Level, T1.ResultCenter_Type, T1.ResultCenter_Usage, T1.ResultCenter_StartDate, T1.ResultCenter_ExpirationDate, T1.ResultCenter_Active, T1.[ResultCenter.Parent_Id], T1.[ResultCenter.Unit_Id])
FROM (
    SELECT
        T.Id AS ResultCenter_Id,
        T.Code AS ResultCenter_Code,
        T.Name AS ResultCenter_Name,
        T.Description AS ResultCenter_Description,
        T.Year AS ResultCenter_Year,
        T.Level AS ResultCenter_Level,
        T.Type AS ResultCenter_Type,
        T.Usage AS ResultCenter_Usage,
        T.StartDate AS ResultCenter_StartDate,
        T.ExpirationDate AS ResultCenter_ExpirationDate,
        T.Active AS ResultCenter_Active,
        T.Parent_Id AS [ResultCenter.Parent_Id],
        T.Unit_Id AS [ResultCenter.Unit_Id],
        True AS _from0
    FROM Context.ResultCenters AS T
) AS T1");
    }

    ///
    /// exibição de retorno para CodeFirstDatabase.RequestItem
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView7()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.RequestItem", @"
SELECT VALUE -- Constructing RequestItem
    [CodeFirstDatabaseSchema.RequestItem](T1.RequestItem_Id, T1.RequestItem_Date, T1.RequestItem_Data_Retorno, T1.RequestItem_Quantity, T1.[RequestItem.Employee_Id], T1.[RequestItem.Unit_Id], T1.[RequestItem.ResultCenter_Id], T1.[RequestItem.TaxiRequest_Id])
FROM (
    SELECT
        T.Id AS RequestItem_Id,
        T.Date AS RequestItem_Date,
        T.Data_Retorno AS RequestItem_Data_Retorno,
        T.Quantity AS RequestItem_Quantity,
        T.Employee_Id AS [RequestItem.Employee_Id],
        T.Unit_Id AS [RequestItem.Unit_Id],
        T.ResultCenter_Id AS [RequestItem.ResultCenter_Id],
        T.TaxiRequest_Id AS [RequestItem.TaxiRequest_Id],
        True AS _from0
    FROM Context.RequestItems AS T
) AS T1");
    }

    ///
    /// exibição de retorno para Context.Invoices
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView8()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("Context.Invoices", @"
SELECT VALUE -- Constructing Invoices
    [GAWeb.VoucherRequests.Model.DAL.Invoice](T1.Invoice_Id, T1.Invoice_Code, T1.Invoice_Date, T1.Invoice_Value, T1.Invoice_Discount)
FROM (
    SELECT
        T.Id AS Invoice_Id,
        T.Code AS Invoice_Code,
        T.Date AS Invoice_Date,
        T.[Value] AS Invoice_Value,
        T.Discount AS Invoice_Discount,
        True AS _from0
    FROM CodeFirstDatabase.Invoice AS T
) AS T1");
    }

    ///
    /// exibição de retorno para Context.Vouchers
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView9()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("Context.Vouchers", @"
SELECT VALUE -- Constructing Vouchers
    [GAWeb.VoucherRequests.Model.DAL.Voucher](T1.Voucher_Id, T1.Voucher_Code, T1.Voucher_Purpose, T1.Voucher_Date, T1.Voucher_Value, T1.Voucher_AdjustedValue, T1.Voucher_Status, T1.Voucher_Note, T1.[Voucher.Employee_Id], T1.[Voucher.Request_Id], T1.[Voucher.Unit_Id], T1.[Voucher.ResultCenter_Id], T1.[Voucher.Invoice_Id])
FROM (
    SELECT
        T.Id AS Voucher_Id,
        T.Code AS Voucher_Code,
        T.Purpose AS Voucher_Purpose,
        T.Date AS Voucher_Date,
        T.[Value] AS Voucher_Value,
        T.AdjustedValue AS Voucher_AdjustedValue,
        T.Status AS Voucher_Status,
        T.Note AS Voucher_Note,
        T.Employee_Id AS [Voucher.Employee_Id],
        T.Request_Id AS [Voucher.Request_Id],
        T.Unit_Id AS [Voucher.Unit_Id],
        T.ResultCenter_Id AS [Voucher.ResultCenter_Id],
        T.Invoice_Id AS [Voucher.Invoice_Id],
        True AS _from0
    FROM CodeFirstDatabase.Voucher AS T
) AS T1");
    }

    ///
    /// exibição de retorno para Context.Employees
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView10()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("Context.Employees", @"
SELECT VALUE -- Constructing Employees
    [GAWeb.VoucherRequests.Model.DAL.Employee](T1.Employee_Id, T1.Employee_Name, T1.Employee_Active)
FROM (
    SELECT
        T.Id AS Employee_Id,
        T.Name AS Employee_Name,
        T.Active AS Employee_Active,
        True AS _from0
    FROM CodeFirstDatabase.Employee AS T
) AS T1");
    }

    ///
    /// exibição de retorno para Context.Requests
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView11()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("Context.Requests", @"
SELECT VALUE -- Constructing Requests
    [GAWeb.VoucherRequests.Model.DAL.Request](T1.Request_Id, T1.Request_Date, T1.Request_Justification, T1.Request_Note, T1.Request_Processed, T1.[Request.Employee_Id])
FROM (
    SELECT
        T.Id AS Request_Id,
        T.Date AS Request_Date,
        T.Justification AS Request_Justification,
        T.Note AS Request_Note,
        T.Processed AS Request_Processed,
        T.Employee_Id AS [Request.Employee_Id],
        True AS _from0
    FROM CodeFirstDatabase.Request AS T
) AS T1");
    }

    ///
    /// exibição de retorno para Context.RequestHistories
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView12()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("Context.RequestHistories", @"
SELECT VALUE -- Constructing RequestHistories
    [GAWeb.VoucherRequests.Model.DAL.RequestHistory](T1.RequestHistory_Id, T1.RequestHistory_Date, T1.[RequestHistory.Request_Id], T1.[RequestHistory.Item_Id], T1.[RequestHistory.Employee_Id], T1.[RequestHistory.Unit_Id], T1.[RequestHistory.ResultCenter_Id])
FROM (
    SELECT
        T.Id AS RequestHistory_Id,
        T.Date AS RequestHistory_Date,
        T.Request_Id AS [RequestHistory.Request_Id],
        T.Item_Id AS [RequestHistory.Item_Id],
        T.Employee_Id AS [RequestHistory.Employee_Id],
        T.Unit_Id AS [RequestHistory.Unit_Id],
        T.ResultCenter_Id AS [RequestHistory.ResultCenter_Id],
        True AS _from0
    FROM CodeFirstDatabase.RequestHistory AS T
) AS T1");
    }

    ///
    /// exibição de retorno para Context.Units
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView13()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("Context.Units", @"
SELECT VALUE -- Constructing Units
    [GAWeb.VoucherRequests.Model.DAL.Unit](T1.Unit_Id, T1.Unit_Code, T1.Unit_Name, T1.Unit_Manager, T1.Unit_Description, T1.Unit_Year, T1.Unit_Level, T1.Unit_Type, T1.[Unit.Parent_Id])
FROM (
    SELECT
        T.Id AS Unit_Id,
        T.Code AS Unit_Code,
        T.Name AS Unit_Name,
        T.Manager AS Unit_Manager,
        T.Description AS Unit_Description,
        T.Year AS Unit_Year,
        T.Level AS Unit_Level,
        T.Type AS Unit_Type,
        T.Parent_Id AS [Unit.Parent_Id],
        True AS _from0
    FROM CodeFirstDatabase.Unit AS T
) AS T1");
    }

    ///
    /// exibição de retorno para Context.ResultCenters
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView14()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("Context.ResultCenters", @"
SELECT VALUE -- Constructing ResultCenters
    [GAWeb.VoucherRequests.Model.DAL.ResultCenter](T1.ResultCenter_Id, T1.ResultCenter_Code, T1.ResultCenter_Name, T1.ResultCenter_Description, T1.ResultCenter_Year, T1.ResultCenter_Level, T1.ResultCenter_Type, T1.ResultCenter_Usage, T1.ResultCenter_StartDate, T1.ResultCenter_ExpirationDate, T1.ResultCenter_Active, T1.[ResultCenter.Parent_Id], T1.[ResultCenter.Unit_Id])
FROM (
    SELECT
        T.Id AS ResultCenter_Id,
        T.Code AS ResultCenter_Code,
        T.Name AS ResultCenter_Name,
        T.Description AS ResultCenter_Description,
        T.Year AS ResultCenter_Year,
        T.Level AS ResultCenter_Level,
        T.Type AS ResultCenter_Type,
        T.Usage AS ResultCenter_Usage,
        T.StartDate AS ResultCenter_StartDate,
        T.ExpirationDate AS ResultCenter_ExpirationDate,
        T.Active AS ResultCenter_Active,
        T.Parent_Id AS [ResultCenter.Parent_Id],
        T.Unit_Id AS [ResultCenter.Unit_Id],
        True AS _from0
    FROM CodeFirstDatabase.ResultCenter AS T
) AS T1");
    }

    ///
    /// exibição de retorno para Context.RequestItems
    ///
    private System.Collections.Generic.KeyValuePair<string, string> GetView15()
    {
        return new System.Collections.Generic.KeyValuePair<string, string>("Context.RequestItems", @"
SELECT VALUE -- Constructing RequestItems
    [GAWeb.VoucherRequests.Model.DAL.RequestItem](T1.RequestItem_Id, T1.RequestItem_Date, T1.RequestItem_Data_Retorno,T1.RequestItem_Quantity, T1.[RequestItem.Employee_Id], T1.[RequestItem.Unit_Id], T1.[RequestItem.ResultCenter_Id], T1.[RequestItem.TaxiRequest_Id])
FROM (
    SELECT
        T.Id AS RequestItem_Id,
        T.Date AS RequestItem_Date,
        T.Data_Retorno AS RequestItem_Data_Retorno,
        T.Quantity AS RequestItem_Quantity,
        T.Employee_Id AS [RequestItem.Employee_Id],
        T.Unit_Id AS [RequestItem.Unit_Id],
        T.ResultCenter_Id AS [RequestItem.ResultCenter_Id],
        T.TaxiRequest_Id AS [RequestItem.TaxiRequest_Id],
        True AS _from0
    FROM CodeFirstDatabase.RequestItem AS T
) AS T1");
    }
}

}
Comment: Faltou você dizer como essa `UnitOfWork` é instanciada e como as `IEntities` são preenchidas.
Comment: @CiganoMorrisonMendez Pronto
Comment: Preciso também do código da classe `Context`. Pode por favor colocar na pergunta?
Comment: Coloquei @CiganoMorrisonMendez
Comment: Só existe este DbSet? `public DbSet Invoices { get; set; }`. Estou atualizando a resposta.
Comment: Sim, adicionei a pergunta a outra classe que tem referência a dbSet
Answer: Se é Code First, está errado você alterar o banco manualmente.
O que é correto fazer é:

Adicionar a coluna diretamente no Model;
Gerar uma Migration através do Package Manager Console: Dentro do seu Visual Studio, vá em View > Other Windows > Package Manager Console:
Add-Migration MinhaMigrationDeAtualizacao

Atualizar o banco após ter gerado a Migration no Package Manager Console:
Update-Database

Se o projeto utiliza migrações automáticas, o passo 2 é opcional.
Para conferir se seu projeto utiliza migrações automáticas, veja o construtor da classe Configuration no seu arquivo Migrations\Configuration.cs, que deve ser mais ou menos assim:
namespace GAWeb.WebApp.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;
    // coloque aqui um using para o namespace onde está sua classe Context.

    internal sealed class Configuration : DbMigrationsConfiguration<Context>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
            AutomaticMigrationDataLossAllowed = true;
        }

        protected override void Seed(Context context)
        {
              /* This method will be called after migrating to the latest version.

              You can use the DbSet<T>.AddOrUpdate() helper extension method
              to avoid creating duplicate seed data. E.g.

                context.People.AddOrUpdate(
                  p => p.FullName,
                  new Person { FullName = "Andrew Peters" },
                  new Person { FullName = "Brice Lambson" },
                  new Person { FullName = "Rowan Miller" }
                ); */

        }
    }
}

EDIT
Essa resposta exigiu esmiuçar muito a aplicação, então algumas providências podem ser tomadas para se ganhar tempo.

Verifique se o contexto possui um arquivo Views acoplado a ele. Essa é uma abordagem antiga do Entity Framework, que não é mais usada desde a versão 4. Este arquivo deve ser removido para funcionar corretamente a abordagem por Migrations.
Verifique se seu projeto faz ou não uso de arquivos EDMX. Se usar, possivelmente esse arquivo tem que ser destrinchado em arquivos de Model. Este link explica como fazer isso.
Comment: Por favor evitem longas discussões nos comentários; a conversa de vocês foi [movida para o chat](http://chat.stackexchange.com/rooms/54190/discussion-on-answer-by-cigano-morrison-mendez-erro-ao-alterar-modelo-de-aplicac)


Style table CSS and HTML

Question: I was wondering how to get these type of lines on a table

When I try to give the the
 a "border right" property, it gives broken space between each cell.
Comment: They are called `border`
Answer: border-right: 2px solid gray ;
HTML

CSS
.bordered
{
  border-right: 2px solid gray ;
}

replace gray with any color you want like #cccccc
Comment: Actually `groove` might be better than `solid`
Comment: Thanks! Perfect! I looks good, was struggling with this for hours. Thanks alot!!!
Answer: Do you want something similar like this example
.td
{
border-right: #ccc 1px solid;
}

Answer: I think what you are looking for is a vertical rule. Html has a horizontal rule

However, it does not have a vertical rule. You can accomplish this with a bit of css though. For example

Style table CSS and HTML


infinity, p2 and p1 Norm and its associated unit ball that has negative y values

Question: ok I try to phrase it in a way that is not redundant with other questions.
I am surprised with the shapes that the norms take on BUT only as far as their extension into the -y regions go. How can that be if norms are non-negative?
Why does the unit "ball" that becomes a square for the infinity norm dive under the x axis, likewise the ball for p2 when norm would correspond to only the upper half of the picture that is usually given for it...
Comment: The point ball is the set of all the points whose norm is 1 meaning all $x$ such that $N(x)=1$. So for example using standard Euclidean norm, $N(1)=1$ AND $N(-1)=1$. Therefore here is a negative number included in the unit ball. The unit ball is NOT composed of the norm values themselves.
Comment: Thank you, I see your rationale but could you perhaps disambiguate. I believe the notation confused me. I sort of expected N to take x and y as input, or if one input it would make sense to me if it was complex. So if you say N(-1), silly question but how should I interpret that -1?
Comment: ok I think I got it. It was quite stupid of me. Of course what's graphed it always only the input pairs (Euclidean space) that fulfill the requirement N(x) as you said. I suppose N(x) is more generic than using (x,y) or z depending on where we are. But in the concrete example that you gave, shouldn't there be still a N(0,1) = 1 or N(1,0) in the Euclidean space?
Answer: The comment was a little sloppy. Let $N$ be a norm in $\mathbb{R}^2$. Then the unit ball is the set of all points in $\mathbb{R}^2$ whose norm is one. So for example if we consider the Euclidean norm, then
$$N(-1,0)=N(0,-1)=N(0,1)=N(1,0)=N\left(-\frac{1}{2},-\frac{\sqrt{3}}{2}\right)=1$$
so all five of these points are on the unit ball. Since the norm is defined for all of the points in the plane, the input to the norm function can be anything, positive, zero, negative. The output must always be nonnegative.
To disambiguate my comment, when I wrote the comment I was thinking only of $\mathbb{R}$ with $N(x)=|x|$ to show that the input to a norm function can be negative. For a generic dimension, we can always use $N(\vec{x})$ where $\vec{x}$ is a vector of whatever type we need it to be.
Comment: Thank you again, the clarification makes perfect sense.


Display a field from a content type which is not displayed in the current node

Question: I can add new variables to the node (like day, month, year) based on current node->created. The problem is I need to display the date field from another content type which is not displayed on the page. How do I fetch it from there?
Here is my code so far:
  function mytheme_preprocess_node(&$vars) {
        $node = $vars['node'];
        $vars['year'] = format_date($node->created, 'custom', 'Y' );
        $vars['month'] = format_date($node->created, 'custom', 'm' );
        $vars['day'] = format_date($node->created, 'custom', 'd' );
      }

and I display them in node.tpl.php simply printing them as $day, $month, $year. I am interested in finding an answer. Thanks.
Answer: I think you're looking for the node_load function.
Example:
function mytheme_preprocess_node(&$vars) {
  // Load node with ID 123.
  $another_node = $node_load(123);
  // Format a date.
  $vars['another_node_created'] = format_date($another_node->created, 'custom', 'Y, m, d' );
}

Beware that node_load returns raw data from the database. While $another_node->created is a safe value to use, user entered data (eg. the title or body text) needs to be checked before you print it (eg. <?php print check_plain($another_node->title); ?>). Not checking raw data is a security risk for your site. See Handle text in a secure fashion for more info.


is $\sin(a)=\sqrt{1-\cos^2(a)}$ derived from $\sin^2(a)+\cos^2(a)=1$

Question: I have a problem of $\cos(a)=t$ for $270\leq a\leq360$$a)\cos(90+a)$for obvious , my answer is the answer is $\cos(90)\cos(a)-\sin(90)\sin(a)$ and left me with $=-\sin(a)$ But what is the proof $\sin(a)=\sqrt{(1-\cos^2(a)}$My solution:
$\sin^2(a)+\cos^2(a)=1$$\sin^2(a)=1-\cos^2(a)$$\sin(a)=\sqrt{1-\cos^2(a)}$ I have a feeling that this is false since I can't find this proof anywhereWere this a real solution or proof to the $\sin(a)=\sqrt{(1-\cos^2(a)}$?
Answer: It is true that $\sin^2(a)+\cos^2(a)=1$, and therefore $\sin(a)$ is a square root of $1-\cos^2(a)$. But this number has two square roots (unless $\cos(a)=\pm1$.) So, it depends upon the sign of $\sin(a)$. If $0^\circ<a<180^\circ$, then indeed $\sin(a)=\sqrt{1-\cos^2(a)}$. And, if $180^\circ<a<360^\circ$, then $\sin(a)=-\sqrt{1-\cos^2(a)}$.
Answer: As stated, it is false. The only thing you can deduce is that
$$\sin a=\pm\sqrt{1-\cos^2a}$$
and the sign depends on which interval $a$ lives ($a$ is in radians):

if $a\in[2k\pi,(2k+1)\pi]$ for some $k\in\mathbf Z$, $\sin a \ge 0$, so you have a $+$ sign;
if $a\in[(2k-1)\pi,2k\pi]$ for some $k\in\mathbf Z$, $\sin a \le 0$, so you have a $-$ sign.
Comment: @Gary: Thank  you for your edit!


MSI Patch Not Working Against A Patched Version (Error 2356)

Question: We have three versions of our software. (e.g. V1.0.1, V1.0.2 and V1.0.3). I created full msi installers for these three versions(V1.0.1.msi, V1.0.2.msi and V1.0.3.msi) with Visual Studio 2010 Setup Project. In addition, I created patch updates (minor upgrades)(.msp package) among them as follows:
Patch_1.0.2.msp (created between V1.0.1 and V1.0.2)
Patch_1.0.3.msp (created between V1.0.2 and V1.0.3)
When applying Patch_1.0.3.msp against a full installation of V1.0.2.msi, it works very well.
But if installing V1.0.1.msi full package first, then applying Patch_1.0.2.msp (which works fine and brings the current version number to V1.0.2), I couldn't install Patch_1.0.3.msp on top of Patch_1.0.2.msp. The following error occurs:
Error 2356:  Couldn't locate cabinet in stream: _38E265F5A43AD31C46B21C2A867AD7BE.
MSI (s) (C0:08) [13:12:30:089]: Product: TestApp -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2356. The arguments are: _38E265F5A43AD31C46B21C2A867AD7BE, ,
What's the difference between the full installation of V1.0.2 (msi installer) and the full installation of V1.0.1 with Patch_1.0.2.msp on top, although the final version number of both are same (V1.0.2)
Both msp packages are "minor upgrades".
Can anybody help me with this? Any ideas, thoughts, advice are very much appreciated.
Answer: It seems like Windows Installer tries to repair the current installation before applying the patch. This is why it tries to find the CAB.
Does Patch_1.0.3.msp work if you manually repair the installation from Control Panel after applying Patch_1.0.2.msp? If it does, you should determine why your package needs a repair after Patch_1.0.2.msp.
Comment: Thanks so much for your quick reply.

I tried to repair the installation after applying Patch_1.0.2.msp, but it failed and threw out Error 2356.

However, I found the solution to my problem. Please see the next answer.
Comment: Finally, I found the solution:

To make the Patch_1.0.3.msp,

1. Make an admin image of "V1.0.1.msi";

2. Patch this admin image with "Patch_1.0.2.msp";

3. Make Patch_1.0.3.msp between this patched image from step 2 and V1.0.3.

But this new patch (Patch_1.0.3.msp) won't work on the V1.0.2.msi full installation.

To install the patches, follow the steps below:

1. Install V1.0.1.msi;
2. Install Patch_1.0.2.msp;
3. Install Patch_1.0.3.msp;

The you will get the final version of V1.0.3.
Answer: Create a patch from 1.0.1 to 1.0.3 and provide a link to the patch depending on the current program version.


running a script from termux-task tasker plugin

Question: I am not able to run a simple script( ls command ) from termux-tasker plugin which i am successfully able to do when i am in termux app in same directory. What could be the cause ?
Termux -tasker plugin requires  requires creation of .termux/tasker directory /data/data/com.termux/files/home/.termux/tasker  which i have done
Here are things which i have tried so far
from termux app
<code>$ sh /data/data/com.termux/files/home/.termux/tasker/script1.sh
</code>
$ sh ./data/data/com.termux/files/home/.termux/tasker/script1.sh
sh: 0: Can't open ./data/data/com.termux/files/home/.termux/tasker/script1.sh
$ bash /data/data/com.termux/files/home/.termux/tasker/script1.sh
$ bash ./data/data/com.termux/files/home/.termux/tasker/script1.sh
bash: ./data/data/com.termux/files/home/.termux/tasker/script1.sh: No such file or directory
$ cd /data/data/com.termux/files/home/.termux/tasker
$ ls
num.py script.sh script1.sh
$ sh script1.sh
num.py script.sh script1.sh
from termux-tasker plugin
exec("/data/data/com.termux/files/home/.termux/tasker/script1.sh"): No such file or directory
Comment: This Q is not about programming as defined for StackOverflow. It **may** be more appropriate on  https://superuser.com or other StackExchange sites. Use the `flag` link at the bottom of your Q and ask the moderator to move it. Please don't post the same Q on 2 different sites. ***Please*** read  https://stackoverflow.com/help/on-topic , https://stackoverflow.com/help/how-to-ask , https://stackoverflow.com/help/dont-ask and https://stackoverflow.com/help/mcve before posting more Qs here. Good Luck
Comment: Also, use 4 spaces at the front of each line of code/data/error msgs OR highlight a block of text and use the `{}` format tool at the top left of the edit box to format as code/data/output. For more info see  and [editing-help](https://stackoverflow.com/editing-help) and [formatting](https://stackoverflow.com/help/formatting). Good luck.
Answer: Did you add a proper shebang?
<code>#! /data/data/com.termux/files/usr/bin/bash
</code>
Add this line to the first line in your script. I had the same problem at first and this solved it. I think Tasker might be using <code>/system/bin/sh</code> as default.


Datgridview cell validation

Question: I have a datagridview with 3 columns and 19 rows.first two columns are read-only. The last column has values already set to 0. User has to input integer values in the last one and I need to validate if it is an integer.if not display message "Enter Integer". I came across the cellleave event and i was thinking it might be the right one to use to perform the check but i don't know how to call that event automatically.
To summarise
-- Values in 3rd column of datagridview already set to zero.
--user inputs value in 3rd column.
--if value is not integer display message "Please enter integer"
I am a beginner in c# and would really appreciate any help on that matter.
Answer: <code> private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            DataGridViewTextBoxCell cell = dataGridView1[e.ColumnIndex, e.RowIndex] as DataGridViewTextBoxCell;

            if (cell != null)
            {
                char[] chars = e.FormattedValue.ToString().ToCharArray();
                foreach (char c in chars)
                {
                    if (char.IsDigit(c) == false)
                    {
                        MessageBox.Show("You have to enter digits only");

                        e.Cancel = true;
                        break;
                    }
                }
            }
        }
</code>

http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/6fc564f9-e154-4be1-8d2c-9988a81e2be7
Comment: Thank you for your reply husnain :)
 i found an easier way to check for inputting the correct format in that column.

private void gridRegisters_CellValueChanged(object sender, DataGridViewCellEventArgs e)

        {
            try
            {
               int num =                           Int32.Parse(gridRegisters.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
            }
            catch (Exception ex)
            {
               MessageBox.Show(ex.Message);
            }
        }

Datgridview cell validation


Proper map from Annulus to The Disc

Question: Let $A(0;1,2):=\{z\in\mathbb{C}:1<|z|<2\}$ denote the annulus with inner radius $1$ and outer radius $2$. Does there exists a proper non constant holomorphic map from $A(0;1,2)$ to $\mathbb{D}$ ?
Comment: I assume you mean something other than $z \mapsto z/2$? What do you mean by proper?
Comment: A map $f:X\mapsto Y$ is proper if for every compact set $K\subset Y$, $f^{-1}(K)$ is compact in $X$.The map $z\mapsto z/2$ is not proper.
Comment: An equivalent definition which I find easy to check is that if you choose a sequence in the domain which converges to the boundary the image sequence does not have a limit point in the Range. In the case of the map $z\mapsto z/2$ if you consider a sequence converging to 1 the image sequence converges inside and hence it can't be proper.
Comment: Yes it is! Note that $f$ is continuous, so for each closed set $K \subseteq \Bbb D, f^{-1}(K)$ is closed in $A(0; 1, 2)$ Since both are bounded, the inverse image of each compact subset of $\Bbb D$ is compact in $A(0; 1 ,2)$.
Comment: @ walcher See the inverse image of the interval $[\frac{1}{2},\frac{3}{4}].$ It's $(1,\frac{3}{2}]$, it is closed but not compact.
Comment: I mean it is closed in annulus and not in $\mathbb{C}.$
Comment: Oh, I see, I thought $A(0; 1, 2)$ includes the boundaries.
Comment: @ walcher oh yeah there is a chance of misunderstanding now I defined it in the question.
Answer: Yes, there is. An example is the Ahlfors function, see e.g. my answer there.
In fact, we have the following Theorem due to Bieberbach, which says that there are many proper holomorphic maps onto the unit disk.
Theorem
Let $X$ be a domain in $\mathbb{C}_{\infty}$ bounded by disjoint analytic Jordan curves $E_1, E_2, \dots, E_n$, and let $p \in X$. For each $j$, fix a point $\alpha_j \in E_j$. Then there is a unique proper holomorphic map $f:X \to \mathbb{D}$ such that $f(\alpha_j)=1$ for all $j$ and $f(p)$=0.
For more information about proper holomorphic mappings, see the preprint there.
Comment: Thanks a lot for your answer and references.
Comment: @Abelvikram : You're welcome.

Proper map from Annulus to The Disc


Whats best practices for handling Drupal 8 core file paths for vendor package.json

Question: I use drupal-vm when setting up my dev environment and have heard that setting up Drupal core files in the document root is a security issue and should be set in a different way.
So I have set my composer.json to:
 "merge-plugin": {
        "include": [
            "docroot/core/composer.json"
        ],
        "recurse": false,
        "replace": false,
        "merge-extra": false
    },
    "installer-paths": {
        "docroot/core": ["type:drupal-core"],
        "docroot/modules/contrib/{$name}": ["type:drupal-module"],
        "docroot/profiles/contrib/{$name}": ["type:drupal-profile"],
        "docroot/themes/contrib/{$name}": ["type:drupal-theme"],
        "docroot/drush/contrib/{$name}": ["type:drupal-drush"],
        "docroot/modules/custom/{$name}": ["type:drupal-custom-module"],
        "docroot/themes/custom/{$name}": ["type:drupal-custom-theme"]
    }

I get issues with the autoload not being able to find the vendor/autoload:
Warning: require(/var/www/site/docroot/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/site/docroot/autoload.php on line 14

Whats is the best practice for placement of Drupal 8 core files?
Comment: _setting up Drupal core files in the document root is a security issue_ While that's definitely true, it's hard to imagine any way you could move the core folder outside of the web root and still have a working site. It's _designed_ to be in the web root; core modules serve their JS and CSS assets from those folders, for example. So if you move /core outside the webroot, at least the CSS and JS for core modules won't work any more. A common approach is to use https://github.com/drupal-composer/drupal-project to at least move the 3rd party vendor libraries outside the root, but not core
Answer: I think this is a slight misinterpretation of the security risk.
The core/ directory needs to be in your DOCROOT; it has assets that the webserver needs to serve up (JS, CSS, and images).
The vendor/ directory should (mostly) be outside of your DOCROOT; some packages have files that shouldn't really be accessed by the webserver directly and have been the focus of recent SAs.
The exception to this are dependencies that need to be served up or be in the proper place, hence why people use the installer-paths to place modules, themes, and JS libraries in the right place.
While not universal, I would say that drupal-composer/drupal-project is a growing best practice, at least for starting points for websites.  This will place vendor/ outside of DOCROOT, take care of the autoloader and scaffold files, and set up a sane set of installer-paths.  Even if I am not using this directly, I look to its composer.json for inspiration.


Time signature vs. Melody

Question: I have a very difficult time understanding the relevance of time signature in music. Does a musician think in terms of time signature when composing a piece, or thinks in terms of melody?
When I play say a complex piece of music in my head I always go with melody, whether it's 3/4 or 4/4 never have a significance because I don't really hear that if I'm not composing for percussions. I guess it's the same for a composer too, he has a melody in his mind and tries to structure that into music. I understand that if a percussion accompanies that piece it needs to find the repetitive beat(and thus time signature is relevant here) but that's not always the case, for example if piece is for a piano only, or the melody is not repetitive.
We don't remember a piece of music by its time signature, we remember it by its melody. So is time signature something later added on paper to make the math right, or does it really have a musical significance?
Comment: Note that melody cannot exist without rhythm and timing information, so you can't think in terms of melody **or** meter/rhythm (which is what time signature is there to communicate).
Comment: Sheet music is very often for situations where the musician does not know or remember the melody. If you know or remember the melody, then one of the things you know is the meter. If you already know the melody, you don't need sheet music at all. For composers, they need a way to write down the rhythm of the melody and a time signature is part of doing that. There isn't right now a better system of writing rhythm and meter that doesn't have time signatures.
Comment: @ToddWilcox why it can't? If one remembers a melody correctly that's enough for him to play it. If he knows the melody, how does time signature affects how he plays it?
Comment: On the other hand, time signatures are not a great way to write down music that has strong rhythm but not a steady pulse. We just don't have anything better available.
Answer: Even if you do not actively analyze the time signature of a piece it is still an intrinsical element of the melody. Let's say you take the motif from Beethoven's Eroica. You do not need to know the piece is in 3/4, the duct of the melody itself strongly implies 3/4. If you were to try to put this into a 4/4 for example you'd either get a highly syncopated feel or you'd need to match the durations to the different meter, such as this:
http://petzel.at/Beethoven-Eroica.mp3

No matter what you do, the duct and thus the quality of the melody changes.
Edit:
In fact, what makes some really popular melodies especially memorable are often not so much the actual notes, but the rhythm and the shape. Consider this example, you easily recognize the melody (if you know it):
Answer: It's all about rhythm.  That's especially important for dance music; if there's no rhythm to the music, the dancers don't know when to move.  But it also matters for most other musical styles.  Simply hitting a sequence of notes in the right order is likely to sound very dull.
Once you have decided what the rhythm is, you can group the notes within bar lines to indicate where the "phrases" are.  If your rhythm is consistent throughout the piece, you will then find that a single time signature describes how many beats there are in each bar.
Answer: There are many tunes that lend themselves to being played in different time signatures. One such is Fly Me to the Moon - actually written in 3/4, nearly always played in 4/4. The tune is still quite recognisable in either, so your supposition doesn't necessarily ring true.
It's my belief that a composer has a particular melody in mind, and that's it. But in order to communicate it to another player, on paper, for example, it needs writing down, and that's when it becomes apparent what its time signature is.
The time signature is an important part of any piece, as it compartmentalises the tune into small segments, which are easy to follow, in a regular beat. Also easier to write, easier to read. In a larger ensemble situation, it's also very useful. Bars can be numbered, so everyone knows where they are, which would be very difficult given no time signature.
Just about every piece will have its own intrinsic rhythm, which to an extent will dictate what that time sig. will have to be. And it seems it's something Humans are happy with - being able to tap one's foot, or even dance along to something. Without a time sig. and its subsequent rhythmic pattern that wouldn't be possible.
Comment: @Hm, cannot speak about the dv, but I do not think that most composers _a particular melody in mind, and that's it_. Compositions usually is much more involved than just writing down a melody. With modern composition we often loose the concept of a strict metrum. But for older composers the time sig was necessarily one of the first things you think about when writing a piece, because the time signature is essential for the character of the whole piece.
Comment: I think we need to differentiate between waltz/swing transformations, where the BIG metrical features are retained  -whichever way you play 'fly me..', the barlines come before 'Fly', 'moon', 'play' etc. - and the complete re-structuring of the same row of notes in @Lazy's Beethoven example above.   The first is commonplace, the second vanishingly rare.
Comment: @Laurence - I think whenever a tune is changed from 3/4>4/4 or vice versa, the bar lines will basically remain where they were originally. No change there. Otherwise the basic melody **does** change drastically.
Comment: Care to validate the dv? Season's greetings.
Comment: @Lazy - thanks. Once a time sig. in a piece has been established, it's probably not given much thought until the writing stage. Certainly not from my writing experience.
Comment: I understand what you say, it makes sense. What I don't understand is that when I play a piece in my head I never clap to it. It's unintuitive to me to "try to clap" to a piece, because the feeling of that piece is in its melody and melody has its own flow, hard to contain the whole song in 1 basic rhythm. If I clap, I'm emphasizing something that's not the inherent feeling of that piece. I understand we need to break it down to manage it for communication, but that's simply a notation to me not the musical substance

Time signature vs. Melody


Reference error variable not define on Object forEach

Question: I am getting reference error w is not defined in forEach object.
this.primaryfilterdata is product json object.
this.primaryfilterdata =[{"id":"Brand","filterValues":[{"id":" FIDO DIDO","count":1,"meta":""},{"id":"addidas","count":1,"meta":""},{"id":"hrx","count":3,"meta":""},{"id":"nike","count":1,"meta":""},{"id":"polo","count":2,"meta":""}]},{"id":"fit","filterValues":[{"id":"28","count":3,"meta":null},{"id":"30","count":5,"meta":null},{"id":"32","count":4,"meta":null},{"id":"34","count":3,"meta":null}],"checked":[]},{"id":"color","filterValues":[{"id":"black","count":3,"meta":null},{"id":"orange","count":3,"meta":null},{"id":"red","count":5,"meta":null},{"id":"yellow","count":6,"meta":null}],"checked":[]},{"id":"size","filterValues":[{"id":"l","count":3,"meta":null},{"id":"m","count":5,"meta":null},{"id":"s","count":3,"meta":null},{"id":"x","count":3,"meta":null},{"id":"xl","count":2,"meta":null}],"checked":[]}]
Here is code

    var pfquery={}
    Object.keys(this.primaryfilterdata).forEach(function(key,index){
      var x=this.primaryfilterdata[key].filterValues
      var atrval=this.primaryfilterdata[key].id
      var w=[];
      Object.keys(x).forEach(function(key1,value){
        //console.log("Original array:", key1);
        var y=x[key1]
        if(y.checked) {
          w.push(y.id);
          pfquery[atrval]=[];
          pfquery[atrval].push(w);
        }
      })

    }.bind(this));

    console.log(pfquery)
    console.log(w)

Comment: w is local scoped within the function ,so console.log(w) means nothing
Comment: You're reassigning an empty array to `w` variable inside a loop. That's why `w` is overwritten.
Comment: Can you post the actual JSON data i.e.: `primaryfilterdata`
Comment: @TomO. i post the json data
Comment: @Shubh if i remove that console.log(x) .. w.push overwrite the previous value..kindly suggest
Comment: I really don't know what you are trying to achieve here  coz console.log(w) will throw exception because w is not in the global scope it is defined inside function's local scope ,rest your code looks syntactically correct .I am not sure about the concept  you are applying though.
Comment: @Shubh  actually major problem is w.push is overwrite previous value ..but i think my code is right why it overwrite previous value..but when i write console.log(w) .. it not write previous value and push current value which is correct  but throw this error w is not define
Comment: Can you explain what your actual end-goal is here instead of asking about the solution that isn't working? See: [XY Problem](http://xyproblem.info/)
Answer: By seeing your code, i believe you are trying to get an object(pfquery) as a result which hold the id of the brands which is checked/selected.
Output like this :
{"Brand":["FIDO DIDO", "nike"]}

first the console.log(w) is mentioned in the wrong place, out of scope. So remove that line, that's the reason you are getting this error.
And i believe the "checked" field in your json object is not mentioned in the right place, i think it should be mentioned inside all the brands filtervalues. then only your code check (if(y.checked)) will work/execute.
Below is the Sample JSON which you have to specify to make your code work properly.
this.primaryfilterdata =[{"id":"Brand","filterValues":[{"id":" FIDO DIDO","count":1,"meta":"", "checked": true},{"id":"addidas","count":1,"meta":"", "checked": true} ]}]

I hope this is what you are expecting to do.
Comment: actually there are checkbox  of filter values on check these checked property get true
Comment: Then I guess your mentioned JSON object is not correct. Can you check on this based on my comments.


Returning true once instead of multiple times in a for loop in Javascript

Question: Hey guys I want to create a function that takes in an array and returns true if the array is an arithmetic series and returns false if it is not. My problem is my for loop is looping through each pair to see if each consecutive pair is divisible by the difference of the first two elements. As a consequence, I am stuck and can only create a function that returns true 4 times when I do have a arithmetic series. Does anyone know how to alter my code so that I only get true or false. Here's what I have:
function arithseries(arr){
    var arit = arr[1] - arr[0];
    for(var i = 0; i < (arr.length - 1); i++){
        if((arr[i + 1] - arr[i]) % arit === 0){
            console.log("true");
            }
        else{
            console.log("false")
        }
        }
    }

arithseries([2,4,6,8,10])

returns
=> true
=> true
=> true
=> true

Answer: function arithseries(arr) {
    var arit = arr[1] - arr[0];
    for (var i = 0; i < (arr.length - 1); i++) {
        if ((arr[i + 1] - arr[i]) % arit !== 0){
            return false
        }
    }

    return true
}

console.log(arithseries([2,4,6,8,10]))

Comment: Why did you remove `else`?
Comment: In the else branch you'd actually say 'okay, everything fine so far - continue testing'. You check each element and as soon as one is wrong, you return `false` (series not correct). When you checked all elements (i.e. after the for loop) you know that the series is valid and return `true`. No need for an else anywhere since the loop will continue anyway.
Comment: Right, but what if the `if` conditional returns false once the loop has stopped wont it also move on from the for loop and return true as well?


Automate and create SSH keys for large number(Nearly 9000) of servers for almost 30 users

Question: Is there a way to automate to create SSH keys for large number(Nearly 9000) of servers for almost 30 users
Comment: Can you describe in detail what you really need done?
Comment: You may want something like http://puppetlabs.com.
Comment: How do you manage/monitor the servers now? If you don't have a method for doing that, I can't imagine how you can work with 9,000 systems!
Comment: All the servers belong to differnt customers with different servers with different login.. Can we make it a uniform  arrangement without any compromise of security for all the customers in same manner.. My goal is to  automate file transfer after creating ssh keys
Comment: In short , all the  servers are managed individually based on the demand for UnifiedCommunication and contact center upgrade ( call center, Enterprise Call handling softwares) by 30 different users .We transfer the upgrade files,do infrastructure verification(Basic Checks to validate if the system is ready for software upgrade ) on the server and finally we perform the upgrade for the given servers for different customers based on the their maintenance window . I would like to understand can we do automation on file transfer and backups by creating ssh keys for all the customers
Comment: Do you think automating execution of upgrade files is also a possibility in this context?
Comment: thanks a lot for your quick response , If we reboot the servers,will the public key would be valid in the server for the users or do we recreate the SSH keys once again after the reboot ?
Answer: If you have 9,000 servers under the same management, you'd likely have some form of configuration management in place. That could be in the form of Puppet, Chef, Ansible, etc. You can distribute public keys that way.
For 30 users, this is also something that could be handled via central directory authentication (LDAP, Active Directory).
Comment: Thanks a lot for your answer.. Can you see my comments above for your question
Answer: You probably do it wrong.
Each user (of the 30) has to create his own (thus private!) key. The public key of each user goes to every server (of the 9000) he should have access to.
Don't do it the other way around.
Answer: If your  servers use decently recent openssh version (> 5.4 I think), you should take a look at the certificate-based authentication there. You'll find an introduction to this feature here: http://neocri.me/documentation/using-ssh-certificate-authentication/ or in ssh package documentation.
To make short,

users generate their private/public key pair.
you (admin) create one or more SSH CA-certificate (your-user-ca) that you will use to sign users public keys.
you (admin) sign users public keys using with one CA-certificate. for example "ssh-keygen -s your-user-ca -I "username" -Z username -V +52w user-key.pub". This creates a user-key-cert.pub you need to send back to appropriate user.
you (admin) install the trusted SSH CA-certificate in sshd config of your 9000 servers. You don't need to declare each public key of each user.
users can connect.

hth.
Answer: I would use Puppet to distribute the public host keys to all machines, so that users can log in and not have to maintain a known_hosts file (as long as they are SSHing within these 9,000 machines).
Host keys:

Have each node create a public/private key. It is safest to generate a key on the machine that uses it, that way the private key never leaves the host and doesn't need to be secured.
Use Puppet's "exported resources" feature to send the Private Key to a central database.
On all nodes, pull in the "exported resources" to generate the known host keys file on this machine.  Any new node will appear in all the other nodes within 2 puppet runs.

Here's an example of exported resources.
Here's a specific example of distributing SSH host keys.
User access:
You can use Puppet to set each hosts's sshd_config file to trust host keys and such, or whatever you want the policy to be:
<code>
augeas { 'sshd_config':
  context => '/files/etc/ssh/sshd_config',
  changes => [
    'set PermitRootLogin without-password',
    'set ANOTHERSETTING VALUE',
  ],
}
</code>
User accounts:
Puppet can also create the 30 accounts on all machines.  I like the accounts module that comes with Puppet Enterprise. However it is easy to do if you have the open source version. Here's an example of how to do that.
Some general advice:
9,000 machines is a large environment. You'll want to keep your Puppet files in Git, use a Continuous Integration and testing framework such as Jenkins CI, and have a test environment that you try things out before you push. How we do this at Stack Exchange, Inc is documented in this blog post.
Comment: Thanks a lot Tom for a much detailed explanation. I really appreciate your help.I would review  these documents and shoot up with queries if I would have .:)
Answer:
Have each user create a public/private key.
Distribute the public key for each user to each server
Profit.

All kidding aside, this is a classic configuration management problem. Consider that in addition to publishing the key you also need to at least create the home directory and the user accounts as well as the individual .ssh directories.
Instead of trying to solve all 30/9000 at once I'd start with automating one user on one server and build from there.
See generally: Puppet, Chef, Salt, Ansible for pointers.


Where do extra parameters come from?

Question: Not a real issue but more of an informative question.
Concrete case:
system.routing.yml integrates system.entity_autocomplete that uses controller::method
\Drupal\system\Controller\EntityAutocompleteController::handleAutocomplete. First parameter in handleAutocomplete() is $request and the rest are the ones we could explect from url.
Where did $request come from?
Answer: This is a feature provided by Symfony:

The Request object as a Controller Argument
What if you need to read query parameters, grab a request header or get access to an uploaded file? All of that information is stored in Symfony's Request object. To get it in your controller, just add it as an argument and type-hint it with the Request class:
use Symfony\Component\HttpFoundation\Request;

public function indexAction(Request $request, $firstName, $lastName)
{
  $page = $request->query->get('page', 1);

  // ...
}

Where do extra parameters come from?


Getopts function issue

Question: Trying to make a bash script that moves files into a trash directory and has some other features. To implement these features I'm trying to use the getopts function but am struggling to even implement a help feature or user manual. When I run the script and try to use -h, the script doesn't recognize it's an option and just runs normally as if it were a file. How can I fix this?
FIXED:
<code>#!/bin/bash
trash=~/TRASH
if [ ! -e $trash ]; then
  mkdir $trash
elif [ ! -d $trash ]; then
  echo "$0: error: $trash is not a directory"; exit 1
fi

while getopts "h" options; do
case $options in
h) echo "This is the help option."
exit;;
\?)
echo: "Invalid option"
exit;;
esac
done

while [ $# -gt 0 ]; do
  if [ ! -e $1 ]; then
    echo "$0: error: tried to delete file that does not exist: $1"
    shift
    continue
  fi
  tarname="$1.tar"
  tar -cf "$tarname" "$1"
  mv "$tarname" $trash
  rm -rf "$1"
  shift
done

echo "Cleaning $trash directory"
now=`date +%s`
cd $trash
for f in `ls`; do
  fileage=$(stat -c '%Y' "$f")
  if [ $((now-fileage)) -gt $((60*60*24*2)) ]; then
    rm -rf "$f"
  fi
done
</code>
Comment: Your code has many issues. Try https://www.shellcheck.net/ to fix them.
Answer: Well it was a simple fix, simply moved the getopts function to the top, to occur before anything else and it works now.
Comment: Yes, you have to process the options before looking at the remaining arguments. After the `while getopts` loop, don't forget to `shift $((OPTIND - 1))`
Comment: What does that do?
Comment: It will remove `-h` from the positional parameters, so the `while [ $# -gt 0 ]` loop will not see it. `getopts` processes the options, but it does not automatically shift them away. It uses the OPTIND variable to count how many arguments to remove.
Comment: I also created an option to do the basic use of the script but for directories, it's very similar, using that same while loop, however in the part where it detects if the directory exists or not, -r is always detected as a directory that doesn't exist. Is this the reason why? I also tried to put this in the -r option but it still happens
Comment: Am I supposed to understand the code that I can't see?
Comment: Fair enough, am posting another question since I got a lot of issues with these options

Getopts function issue


Numerical Methods for Linear Matrix Equation

Question: How can I solve (numerically) the linear equation $AB=0$. where $A\in\mathbb{R}^{n\times n}$ and $B\in\mathbb{R}^{n\times m}$?
How much is the computational cost?
Comment: $B=0^{n\times m}$  costs nothing, it's free!
Comment: Solve for what? Do you want to find one solution, or all solutions?
Comment: Yeah, sorry.. the matrix B is the unknown matrix while the matrix A is known. I need just a solution B.
Comment: of course B not $0$. In particular i would like
$$B = \left[ \matrix{
  {I_n}  \cr
  X  \cr}  \right]$$ with $X\in \mathbb{R}^{m\times n}$
Comment: Your dimensions don't match up. You said that B is nxm, but you now seem to be asking for it to be (n+m)xn.
Comment: I think you are looking for the _nullspace_ of $A$. http://www.cliffsnotes.com/study_guide/The-Nullspace-of-a-Matrix.topicArticleId-20807,articleId-20787.html
Comment: The maximum number of columns of $B$ is the dimension of the nullspace of $A$, which is less than $n$ unless $A=0$.
Answer: I find it helpful to reformulate the equation with the help of the Kronecker Product: With the vectorization operator $\mathrm{vec}$ which stacks all columns of a matrix into a large vector it holds that
$$
\mathrm{vec}(ABC) = (C^T\otimes A)\mathrm{vec}(B)
$$
and this allows you to reformulate $AB=0$ as a usual linear system for $B$.
Answer: You may treat $B$ one column at a time:
\begin{equation}
B = \Bigg[b_1\;\;b_2\;\;\ldots\;\;b_m\Bigg]
\end{equation}
where the $b_i$ are column vectors of length $n$ (and there are $m$ of them).
If $A$ is invertible, it spans $\mathbb{R}^n$ and the only solution is $B=0$. Otherwise you are looking for vectors $b_i$ in the nullspace of $A$. Suppose $A$ has rank $r$ (number of independent columns). Then dim N($A$) = n-r. This means that there are $n-r$ independent vectors that give $Ax=0$; these x's form a basis for N($A$). So every matrix $B$ whose columns are linear combinations of these x's will give $AB=0$.
As for computational cost, the effort is in finding a basis for N($A$). Usually this is an operation of order $O(n^2)$.
Reducing $A$ to it's echelon form, the columns which do not look like the identity matrix will contain the basis for the nullspace (in MATLAB this is rref(A) and in Mathematica it is RowReduce[A]).


Is it possible to include integral transformation of a variable in Bayesian hierarchical models?

Question: I am tackling a problem, which might be described by the following analogy:
Suppose we have N similar cars riding on the road, and their speed depends on several factors: proportion of chemicals in gasoline (continuous variable), whether a car has a powerful engine (categorical), and the quality of the part of the road that the car rides on a given moment (might be continuous or discrete).
We have some estimates of how exactly these factors influence speed from engineers/experts, so we want to include this prior knowledge of coefficients by running a Bayesian inference rather than just fitting a regression as is.
The problem is that to fit any kind of model, we have to have both independent variables and targets, but we do not have any data for the speed of cars - instead we only know the total distance these cars traveled on the road. This means that the only target variable we can train our model with has to be derived from speed as some integral of speed over time and road quality (for these we also have the data).
My question is: does Bayesian inference somehow allow for this integral kind of variable/distribution transformation in hierarchical modeling? It gives us the power to transform variables by exponentiating them or passing them as parameters to other distributions, but I have no idea about integrals.
If it is possible (maybe with some other method than BI), I would also like to know how to evaluate this proxied speed formula, and/or use some potential scarce data about these speeds (from limited experiments) to train the general model.
Thank you in advance!
Answer: Yes, if you can write down the integral, then this is possible. You'll almost certainly end up using some MCMC sampler and the details depend on the sampler. You basically need to somehow calculate the parameters of the likelihood function for what you observe from the underlying parameters your interested in and that can involve integrals (or differential equations etc.).
With "traditional" (e.g. Metropolis-Hastings type) samplers, you just need a function that evaluates the integral to plug that in (some MCMC samplers such as PROC MCMC in SAS have numeric integration by quadrature available and that's not too crazy to manually implement, either), while with modern Hamiltonian Monte Carlo samplers you'll also need derivatives of the integral (or express it so that auto-differentiation can obtain this for you). E.g. Stan (which you can use in R via the rstan package or in some situations via the simpler brms, in python via pystan etc.) has ready made capabilities for 1d-integrals, while for more complex integrals some more thinking/re-expressing as differential equations (for which there are then various differential equation solvers available). You might also be able to sample from the integral without having to numerically solve it. Of course, these tend to be time consuming steps, so 1) make sure you cannot analytically solve the integral and 2) if you have computers or servers with lots of CPUs, then use the parallelization capabilities of tools like Stan.
Comment: Thank you for the answer. Took me some time to investigate the concepts, but I got the gist of it now. Basically I am okay if I can write an integral as a direct formula of the variables I have, but for some functions they involve nonbasic operations like Г functions and the likes, and finding derivatives for them might be even more complicated… I have tried to code my toy example in pymc3 and encountered serious convergence issues to the true parameters, but I might be modeling something in a wrong way, but at least I know now that this operation makes sense.
Comment: I don't know PyMC3 as well as Stan, but I believe it does (like Stan) have nice buildt-in versions of things like the gamma function that you should be able to just use within an integral. Of course, if you can rewrite things to use the log-gamma (lgamma) function instead, things are usually much more stable. E.g Gamma(a) + Gamma(b) as exp(log_sum_exp(lgamma(a), lgamma(b))) could make a difference. Divergences are of course not likely about parameterisation, parameters that are not well identified by the data and/or too weak priors.


Why does my samba server serve data so slowly even when said data is cached?

Question: I have a CentOS 5.6 server with the base Samba install. It has an 8 drive Raid 5 attached to an Areca 1880, hdparm tests give me back ~450MBps and I can confirm close to that with a dd to /dev/null. Serving out files to the network is a 10gbe Myricom card, and the clients are all 1gbe broadcom/intel/etc, on the same switch.
The problem I have seems to be fairly consistent throughout, single stream file copy performance is poor when the files have not been cached into memory on the server. I am talking about 9-12MB files if I copy a 1GB file, performance is through the roof, usually 90%+ on the 1gbe clients. When I copy 9-12MB files, say 100 of them, it will get roughly 40-50% usage, once they are cached on the server it will do MAYBE 55-65% usage on the 1gbe client NIC, but never more. Why?!?
I can copy multiple cached sequential file sequences and get to maybe 85%+ usage on the client NIC, why can't a single file sequence hit 95%+? All the clients are setup to offload tx/rx packets to the adapter, unfortunately they aren't using Jumbo Frames but I have tested with Jumbos turned on and still saw the same performance.
Answer: Large, sequential access is the best case scenario, and what you say, your system saturates the pipe in that scenario.
Many smaller files vs one big file result in metadata and possibly locking overhead. I guess that with more than one stream you get several transmiting data, and on multi-core system they can do it in parallel, increasing bandidth. This behaviour seems to indicate, that you are bound by a single-thread performance for many small files. If you can test with a SSD you'll know, if the performance problem is from disk I/O (locking, modifying access times, metadata) or are you CPU bound (you could also see a samba process eating a whole core on top display while transferring data, which would be a good indicator).
You can also play with SystemTap and see where exactly is kernel spending the time in "large file" and "many small files" scenarios.
Comment: I setup a ramdisk and copied the files thinking that disks might be the problem, network performance didn't change. Also, with regard to Samba it is multithreaded for clients at least, probably not with individual transfers to single clients, I wonder if there is a way to multithread smb processes to each client. I am going to try systemtap though, thanks!


If retornando sempre false no reduce()

Question: Tô tentando fazer um simulacro de como seria um processo de autenticação com js puro (só pra dominar arrays), já consegui com outros métodos como filter, find, some, for, foeach etc. Porém com reduce, o if que faria a checagem dos dados retorna sempre false, independente do input do "usuário". Já tentei todos os statements possíveis todavia o resultado é sempre o mesmo
//função que seria chamada por um form
function auth() {

    //inputs do usuário
    var usernameInput = "a";
    var passwordInput = "a";

    //este seria o banco de dados
    const users = [
        {
            username: "a",
            password: "aa"
        },
        {
            username: "b",
            password: "bb"
        },
        {
            username: "c",
            password: "cc"
        }
    ];

    //hashmap pra percorrer o banco de dados
    return users.reduce((msg, elemento) => {
        //ifs que retornariam uma mensagem para o usuário
        if (elemento.username == usernameInput && elemento.password == passwordInput) {
            return msg = 'log successful!';
        }
        //este sempre é o retorno :|
        else {
            return msg = 'wrong username or password';
        }
        if(!usernameInput || !passwordInput) {
            return msg = 'empty username or password';
        }
    },0);

}

Comment: O que voce gostaria que o reduce retornasse? Reduce é pra reduzir arrays a um único valor (por exemplo, numa arrays so de números, a soma desses números).
Answer: Não faz sentido usar reduce para isso
Leia a documentação para entender o que reduce faz. Basicamente, ele recebe uma função, executa esta função para cada elemento do array e combina os resultados. A própria documentação tem vários exemplos de uso (por exemplo, para somar todos os números de um array, entre outros).
Mas você não quer combinar os resultados do processamento dos itens do array. O que você quer fazer é verificar se um dos elementos do array possui determinados dados. Nesse caso, não invente, use um for:

function auth(users, username, password) {
    for (let user of users) { // faz um loop por todos os users
        if (user.username == username && user.password == password) {
            return true; // encontrei, retorna true
        }
    }
    // se chegou aqui é porque não encontrou ninguém, retorna false
    return false;
}

const users = [
    { username: "a", password: "aa" },
    { username: "b", password: "bb" },
    { username: "c", password: "cc" }
];

console.log(auth(users, 'a', 'a')); // false
console.log(auth(users, 'a', 'aa')); // true

Também mudei a função auth para receber como parâmetros o array de usuários, além do usuário e senha que devem ser procurados. Assim a função fica mais genérica, podendo ser reusada - essa é a ideia de funções, aliás, poder reaproveitar o mesmo algoritmo para parâmetros diferentes. Da forma que você fez, ela só funcionava para um grupo de usuários específico, mas fazendo da forma acima, você poderia usar outro array de usuários, por exemplo, que funcionaria sem problemas.
E fiz a função retornar somente true ou false (encontrou ou não o usuário/senha). Pois aí quem chamou a função que faça o que quiser com o resultado (podendo inclusive mostrar alguma mensagem). Acho melhor assim porque se a função retornasse a mensagem você ficaria muito dependente do texto específico, já retornando somente um boolean você pode mudar a mensagem à vontade:
if (auth(users, username, password)) {
    // autenticado: mostra uma mensagem qualquer
} else {
    // não autenticado: mostra outra mensagem
}

// *** As mensagens podem ser mudadas sem precisar mudar a função ***

Isso é melhor, porque se a função retornasse a própria mensagem, você teria que fazer algo como:
if (auth() == 'log sucessful!') {
    ...
}

E se um dia a mensagem mudasse, você teria que mudar todos os if's que verificam o retorno da função.

No seu caso você quer uma mensagem específica caso os dados estejam em branco, então bastaria ter outro if:
if (!username || !password) {
    // mensagem dizendo que os dados estão em branco
} else if (auth(users, username, password)) {
    // autenticado: mostra uma mensagem qualquer
} else {
    // não autenticado: mostra outra mensagem
}

Pois se estiver em branco, nem valeria a pena chamar a função de autenticação - afinal, eu entendo que validar os dados (verificar se foram preenchidos) é uma ação diferente de autenticar (verificar se o usuário e senha batem), por isso eu deixaria isso fora da função auth.

Por fim, outra alternativa é usar some, que verifica se algum dos elementos do array corresponde ao critério informado:
function auth(users, username, password) {
    return users.some(user => user.username == username && user.password == password);
}

E claro, o for mais tradicional:
function auth(users, username, password) {
    for (let i = 0; i < users.length; i++) { // faz um loop por todos os users
        if (users[i].username == username && users[i].password == password) {
            return true; // encontrei, retorna true
        }
    }
    // se chegou aqui é porque não encontrou ninguém, retorna false
    return false;
}

If retornando sempre false no reduce()


A cubic polynomial over $\mathbb{Q}$ with a degree three splitting field?

Question: I'm wondering if it's possible to have a cubic polynomial $f(x)\in\mathbb{Q}$ with three distinct roots (in $\mathbb{C}$) that has a degree three splitting field?
If $f(x)=(x-a)(x-b)(x-c)$, with $a,b,c$ distinct, then I believe they must all be real, because otherwise we would get an automorphism of order two (complex conjugation) in $\operatorname{Gal}(f)\cong \mathbb{Z}/3\mathbb{Z}$, contradicting Lagrange's theorem. Now, I can't cook up an example that works, but I'm not sure how to prove nothing does work either. What am I missing?
Comment: See [this question](https://math.stackexchange.com/questions/1561108/proving-that-mathbbqx-1-sqrtd-is-the-splitting-field-of-all-irreduc).
Comment: $\Bbb{Q}(\cos(2\pi / 7))$ (embed in the abelian extension $\Bbb{Q}(\zeta_7)/\Bbb{Q}$)
Comment: See also https://math.stackexchange.com/questions/1767252/expressing-the-roots-of-a-cubic-as-polynomials-in-one-root
Answer: All you need is a cubic polynomial whose discriminant is a square.
E.g. $f(x) = x^3 - 3x + 1$.
Reference: the wiki page on cubic equation
Answer: Such fields are known as cyclic cubic fields, because their Galois group is cyclic of order 3. Here's the LMFDB's list of cyclic cubic fields, which includes over four thousand examples.
One easy example (and the first entry in the list) is the cubic subfield of the cyclotomic field $\mathbb{Q}(e^{2\pi i/7})$, which has Galois group $\mathbb{Z}/6\mathbb{Z}$ and therefore has a unique cubic subfield.


What's the best practice to connect a table to a junction table in relational database design?

Question: I'm building a relational database that will act as a CRM for a travel company. I have removed tables and attributes to make this as simple as possible. Users will send quotes to customers.
A hotel can have many rooms (e.g. hotel 1 can have both a twin room and a triple room).
A room can have many hotels (e.g. a both hotels 1 and 2 can have a twin room).
Let's say a customer has a group of 6.
A user could send this customer a quote for hotel 1 with either 3x twin rooms or 2x triple rooms.
A quote will need to contain the hotel and appropriate room type and room type quantities.
Whats the best practice to connect table HOTEL_ROOM_JUNCTION to QUOTE as they key is a multi-attribute, composite key?

Thank you
Comment: Please [use text, not images/links, for text--including tables & ERDs](https://meta.stackoverflow.com/q/285551/3404097). Paraphrase or quote from other text. Give just what you need & relate it to your problem. Use images only for what cannot be expressed as text or to augment text. Images cannot be searched for or cut & pasted. Include a legend/key & explanation with an image.
Comment: This is a faq. Before considering posting please always google any error message or many clear, concise & precise phrasings of your question/problem/goal, with & without your particular strings/names & site:stackoverflow.com & tags, & read many answers. If you post a question, use one phrasing as title. See [ask] & the voting arrow mouseover texts.
Answer: Noting the Relational Database tag.
Problem

There is a lack of precision in your declarations:

A hotel can have many rooms (e.g. hotel 1 can have both a twin room and a triple room).
  A room can have many hotels (e.g. a both hotels 1 and 2 can have a twin room).

I think you mean RoomType.  From the rest of your declarations, the system you are implementing is for Quotations of rooms across all hotels, not a room booking system for each of the hotels.  That is, you need to track RoomType, not Room, per Hotel.
The tables as given are not Relational tables, they do not have any of the requirements that make them Relational.  When you start with stamping an id field on every file, it cripples the data analysis & data modelling exercise that is required to create a set of Relational tables.  That is anti-Relational:

physical pointers such as record id are expressly prohibited in the Relational Model.
The Primary Key must be "made up from the data".
I appreciate that you have been schooled in that, due to the marketing and promotion of primitive methods as "relational".

.
For starters, each logical row (not physical record with a record id) must be unique.

The fields in each file should not be prefixed with the filename.  In SQL (the data sub-language for the implementation of the Relational Model), the fully qualified address for a column is:
[server.][database.][owner.][table.]column
with defaults (obvious) for each element. If a column is ambiguous, simply prefix it with the table name.

Primary Keys are a special case.  In order to avoid confusion (and now, to allow the new NATURAL JOIN), they should be the full name, in both the PK and FK locations.  An id on every file would ensure buggy code.

Relational Data Model
If I address all those issues, and model the data according to the Relational Model, it would be:

Notation

All my data models are rendered in IDEF1X, the Standard for modelling Relational databases since 1993.
My IDEF1X Introduction is essential reading for those who are new to the Relational Model, or its modelling method.  Note that IDEF1X models are rich in detail and precision, showing all required details, whereas home-grown models have far less than that.  Which means, the notation has to be understood.

Content

Relational Key
In order to make the logical rows unique, we need to make a Key from the data.  The users know their data, they know what is unique and what is not.  Usually they will have a ShortName for such things as Company; Hotel; Customer; etc.

If you do not communicate with the user, there is no chance of supplying the user's needs.
Hotel, UserName, Customer are ShortNames, which are unique, which therefore are the Primary Key.  (More, later)
Relational Keys are composites, because they preserve the natural data hierarchies.  Get used to it.
If you need the DDL for composite Keys, please ask.
Presuming that a Hotel may be a chain or franchise, we need a Location to make a specific hotel that has rooms unique.

The following are discrete Facts, and should not be mixed together (doing so will lead to complex constraints and horrendous SQL code):

HotelRoomType
that a Hotel.Location has a particular RoomType; and the Price
RoomTypeAvailable
that a Hotel.Location has one of those RoomTypes available on a particular Date; and the Number.
I presume there is a file from the hotels that you will be importing on a daily basis: this is the central table for that, with the constraints, of course.
Quote
that an User is providing a Quote that is requested by a single Customer, for a single TravelDate, for a single Hotel.Location.  This allows separate Quotes for separate Hotel.Locations for a single TravelDate; Quotes for a Customer for more than one TravelDate; etc.
.
If you need multiple Hotel.Locations (and their RoomTypes) on a single Quote, let me know in the comments, and I will update the data model.
QuoteRoomType
that a Quote contains a line item which is a single RoomType in the single Hotel.Location that is available on the TravelDate.

Relational Integrity
A logical feature of the Relational Model, which is distinct from Referential Integrity, which is a physical feature in SQL.  It is not possible to achieve this in a Record Filing System with record ids as "primary keys", not even an advanced and progressed one (after the various errors in the initial RFS have been corrected).  Genuine logical Keys ("made up from the data") are required.

In RoomTypeAvailable, we have constrained:

RoomTypes to that which the Hotel.Location actually has (in HotelRoomType)
AND is actually available on Date.

In QuoteRoomType, we have constrained:

Hotel.Location to that which is in the Quote,
AND RoomTypes to that which is available in Hotel.Location (in HotelRoomType),
AND which is available on the TravelDate (RoomTypeAvailable.Date "maps to" QuoteRoomType.TravelDate).

1960's Record Filing System • Anti-Relational, Sold as "relational"

This section is relevant for those who prescribe a Record ID field as "primary key" in every file.  And somehow think that that is "relational".  Others can safely skip it.

For comparison, here is the set of files that one would come up with, if one followed the techniques and methods that are promoted and marketed by Date; Darwen; Fagin; et al crowd, falsely proposed as "relational".

This a "mature" or "advanced" model, the fourth or fifth iteration.  It has a number of improvements over the initial RFS.  The initial or second or third iteration would not be equivalent enough to offer a comparison:

the Facts that are required to support the system have been determined (as opposed to the initial model, the record perspective, which is oblivious to Facts).
the content of the records have been improved to prevent duplicates, to the extent possible given the record content (but it is still streets behind the uniqueness provided in a Relational data model)

Fails Relational
Nevertheless it has no Relational features, which are logical.  It has only the physical features of SQL reference-ability.  Just a few of the many failures, which the mob prescribes as "relational":

Duplicate rows (logical) are not prevented, because rows are not defined.
No Relational Integrity
which depends on Relational Keys.  (Refer to the Relational Keys detailed above.)

Eg. QuoteRoomType is constrained to any RoomTypeAvailable.
It is not possible to constrain it to:

the HotelId that is referenced in the Quote only,
OR to RoomTypes that exist in the HotelId only,
OR to RoomTypesAvailable that are available on the TravelDate only.

One additional field, and one additional index, for the Record id on every file.  That will have a marvellous effect on performance.
Horrendous navigation and query code.
No Relational Power
When two distal files need to be JOINed, each of the intermediate files must be additionally JOINed, something that is not required in a Relational database.  That is because it breaks the Access Path Independence Rule, a concept that the razor gang have not been understand in the fifty years since the advent of the RM.  But they will come up with yet another abnormal "normal form", to add to their bag of seventeen thus far.

More, Not Fewer, Joins
Let's look at what that means.  We need a query to provide statistics for RoomTypes that have been quoted for previous year, so that hotels can re-arrange their room types to suit the expected traffic.

Using the Relational data model (separate section above), we would code:

SELECT RoomType.RoomType,  -- Relational database
       Description,
       SUM( NumRoom )
    FROM RoomType
        JOIN QuoteRoomType ON RoomType.RoomType = QuoteRoomType.RoomType
    WHERE DATEPART( YY, TravelDate ) = DATEPART( YY, GETDATE() ) - 1
    GROUP BY RoomType.RoomType, Description

Using the Record Filing System data model, which is the result of following the advice of the Date; Darwen; Fagin; philipxy; AntC; et al gang, which is falsely marketed as "relational" (above), we would be forced to code:

SELECT RoomType,           -- Record Filing System
       Description,
       SUM( NumRoom )
    FROM RoomType
        JOIN HotelRoomType
            ON RoomType.RoomTypeId = HotelRoomType.RoomTypeId
        JOIN RoomTypeAvailable
            ON HotelRoomType.HotelRoomTypeId = RoomTypeAvailable.HotelRoomTypeId
        JOIN QuoteRoomType
            ON RoomTypeAvailable.RoomTypeAvailableId = QuoteRoomType.RoomTypeAvailableId
        JOIN Quote
            ON QuoteRoomType.QuoteId Quote.QuoteId
    WHERE DATEPART( YY, TravelDate ) = DATEPART( YY, GETDATE() ) - 1
    GROUP BY RoomType, Description

Gotta love the QueryPlan for that, that the SQL platform will produce.

Re-arranging the order of the JOINs might improve the tortoise.
Resorting to moving fragments such as "partial FDs" or "MVDs" around, might improve it.

Perhaps deploying more "candies", plus the required additional indices, all over the place, will help.  But wait, that would be duplication on a mass scale, it would break Normalisation, there would be Update Anomalies everywhere one looks.
Note that that result set has no reliability; no credibility.  Why ?  Because, as already proved, the QuoteRoomType is not constrained to the Quote.Hotel (referenced by HotelId);
or to the Quote.TravelDate;
or to the RoomTypes available in QuoteHotel (referenced by HotelId).

Further, there may well be duplicates, because prevention can only be partially implemented.  The result of which is unreliable result sets.

Simplicity vs Complexity
If you have the interest and the stamina, you can attempt to elevate the RFS by muddling through their "partial dependencies"; "transitive dependencies"; "candies"; "multi-valued dependencies"; etc, all of which are neither defined in, nor required in, the Relational Model.  They are expressly for use in the Record Filing Systems of the last century.

First, the RFS paradigm (marketed as "relational") forces a record mindset, instead of a data-only mindset.
Second, it breaks everything down into fragments, instead of understanding the atoms; the Facts, in their full context (data hierarchies).
Third, it gives you a morass of complexity to handle the fragments, that have no relevance when handling atoms.

When you are done, all that complexity in the Record Filing System will still not be anywhere near the simplicity of the equivalent Relational data model: it will have:

No Relational Integrity (yes, yes, we have Declarative Referential Integrity, and that only for physical records, not for logical rows)
No Relational Power (multiple forced JOINs in every query)
No Relational Speed (those additional columns and indices have an effect).

And the navigation and query code will be horrendous, and prone to errors.

Please feel feel to ask specific questions.  Also, please supply clarifications as noted, and I will update the data model.
Answer: Since a specific room can only exist in one hotel the table HOTEL_ROOM_JUNCTION is redundant. So pk hotel_id is fk in rooom, and pk in room is a concat key of hotel_id and room_id.
If one quote can consist of several rooms you need a connecting table between quote and room them with fk quote_id, room_id and hotel_id and those three will be the pk in that table. (As a rule of thumb, that kind of table will usually need a timestamp).
(as a side note; I would name the tables QUOTES, ROOMS and HOTELS since they contain many)
EDIT: I miss read the question somewhat .. to make my model as OP wants I need to add ROOM_TYPES with pk room_type_id which will be fk (not null) in ROOMS but not part of the pk.
Comment: For the new junction table fk quote_id, room_id and hotel_id - would I need the hotel_id in this table as it's already in the ROOMS table and represented by the room_id? Thanks again :)
Comment: If your id's are just counters you don't need to use composite keys. Weather to use composite keys or not is a much larger question.


Coluna tipo Lista

Question: Trabalhei muito tempo com o PostgreSQL e agora com o SQL Server tenho sentido falta de algumas características que facilitavam muito a vida.
Tenho por exemplo uma tabela que uma de suas colunas deve ser uma lista de strings, ou seja, um array de varchar (no postgre era tudo muito simples):
CREATE TABLE MyTable (
    id         integer PRIMARY KEY,
    name       varchar(30),
    questions  varchar(50)[]
);

Infelizmente no SQL Server isso não é possível. Eu poderia fazer uma segunda tabela chamada QuestionsForMyTable:
CREATE TABLE QuestionsForMyTable (
    id_of_mytable   integer,
    question        varchar(50)
);

E ai fazer o devido relacionamento, mas ei eu caio na desgraça de ter que fazer mais um JOIN.
Isso realmente é o que me resta ou existe outra saída melhor?
Comment: Sim, é isso mesmo
Answer: "para não deixar a pergunta sem resposta.."
Sim, se existe uma lista dentro de um objetos e isso será levado ao banco de dados, deve ser criada uma segunda tabela que conterá esses itens da lista; e a forma de se carregar o objeto completo será através de um join:
SELECT *
FROM MyTable
JOIN QuestionsForMyTable ON id = id_of_mytable

Segundo definição do devmedia, "por meio dessa cláusula, os dados de uma tabela são usados para selecionar os dados pertencentes à outra tabela".
Answer: Boa tarde,
Isto pode ser feito recorrendo a uma Computed Column que retorne os valores de uma outra tabela. Pode ser feito da forma descrita a seguir.
Criar e popular a tabela com os elementos para alimentar a computed column:
CREATE TABLE QuestionsForMyTable
(
    id_of_mytable   integer,
    question        varchar(50)
)

INSERT INTO QuestionsForMyTable
    SELECT 1, 'Question 1' UNION
    SELECT 1, 'Question 2'

Criar uma função que retorne os elementos desta tabela para um determinado Id:
CREATE FUNCTION dbo.GetValue(@id int)
RETURNS nvarchar(max)
AS
BEGIN

    DECLARE @ret nvarchar(max)
    SET @ret = ''

    SELECT  @ret = @ret + CHAR(13)+CHAR(10) + question
    FROM    QuestionsForMyTable
    WHERE   id_of_mytable = @id

    RETURN @ret

END

Criar a tabela com a computed column baseada nesta função:
CREATE TABLE MyTable
(
    id         integer PRIMARY KEY,
    name       varchar(30),
    questions  as dbo.GetValue(id)
)

INSERT INTO MyTable
    SELECT 1, 'First set of questions' UNION
    SELECT 2, 'Second set of questions'

No final, basta um select à Mytable para obtermos o resultado esperado.
SELECT * FROM MyTable

Comment: (1) Funções do tipo escalar tornam o processo de execução da consulta mais lento; (2) Além disso, a solução acima cai no problema _quem nasceu primeiro: o ovo ou a galinha_, pois necessita que as questões já tenham sido previamente incluídas. Ora, como inserir as questões se o objeto principal ainda não existe?!
Comment: Sim, uma solução deste tipo não pode ser aplicado a grandes volumes de dados, iria ficar lento. Quanto ao resto, tudo tem a ver com a arquitetura montada, ter ou não dados numa ou noutra tabela não impede o seu funcionamento. Penso que, aqui, o únicio problema pode ser mesmo a lentidão com grandes volumes de dados.

Coluna tipo Lista