lunes, 4 de diciembre de 2023

cannot connect to wmi provider. you do not have permission or the server is unreachable

abrir cmd como administrador.


Ejecutar :

cd  C:\Program Files (x86)\Microsoft SQL Server\150\Shared


(o version que tengan instalada )


Y ejecutar  mofcomp sqlmgmproviderxpsp2up.mof




jueves, 20 de agosto de 2020

npm ERR! Maximum call stack size exceeded

 Para solucionar esto hay muchas formas comentadas en la web

Pero a mi me funciona con lo siguiente:

ejecutar:

npm update

martes, 11 de febrero de 2020

Error al ejecutar el generador de codigos seleccionado: Referencia a objeto no establecida como instancia de un objeto

Este error me aparecia cada vez que queria agregar un controlador al proyecto de visual studio 2017.

La solucion fue la siguiente:

Cerrar el visual studio
Abrir el visual studio.



miércoles, 30 de octubre de 2019

Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".

Para solucionar esto en asp.net mvc,

Tuve que realizar la siguiente modificacion:


Este codigo originalmente estaba asi:

app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    // Enables the application to validate the security stamp when the user logs in.
                    // This is a security feature which is used when you change a password or add an external login to your account. 
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                        validateInterval: TimeSpan.FromMinutes(30),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });



Y luego, comente  lo de OnValidateIdentity quedando asi:



 app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    // Enables the application to validate the security stamp when the user logs in.
                    // This is a security feature which is used when you change a password or add an external login to your account. 
                    //OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                    //    validateInterval: TimeSpan.FromMinutes(30),
                    //    regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });

jueves, 15 de agosto de 2019

Obtener el dia de la semana SQL Server

El siguiente script devuelve el numero del dia de la semana

SELECT DATEPART(WEEKDAY, GETDATE())

Obtener el numero de semana del mes SQL server

Para obtener el numero de semana del mes en sql se puede usar el siguiente ejemplo:


DECLARE @DATE DATETIME
SET @DATE = '2019-06-01'

SELECT DATEPART(WEEK, @DATE)  -
    DATEPART(WEEK, DATEADD(MM, DATEDIFF(MM,0,@DATE), 0))+ 1 AS WEEK_OF_MONTH




Si se tiene en cuenta que el corte de semana  es luego del primer domingo:



declare @date datetime = '2019-06-03'
select datediff(week, dateadd(week, datediff(week, 0, dateadd(month, datediff(month, 0, @date), 0)), 0), @date - 1) + 1;