jueves, 19 de noviembre de 2015

Mejores Prácticas T-SQL

https://msdn.microsoft.com/en-us/library/ms187926.aspx

Mejores prácticas al construir Store Procedures

Best Practices

Although this is not an exhaustive list of best practices, these suggestions may improve procedure performance.
  • Use the SET NOCOUNT ON statement as the first statement in the body of the procedure. That is, place it just after the AS keyword. This turns off messages that SQL Server sends back to the client after any SELECT, INSERT, UPDATE, MERGE, and DELETE statements are executed. Overall performance of the database and application is improved by eliminating this unnecessary network overhead. For information, see SET NOCOUNT (Transact-SQL).
  • Use schema names when creating or referencing database objects in the procedure. It will take less processing time for the Database Engine to resolve object names if it does not have to search multiple schemas. It will also prevent permission and access problems caused by a user’s default schema being assigned when objects are created without specifying the schema.
  • Avoid wrapping functions around columns specified in the WHERE and JOIN clauses. Doing so makes the columns non-deterministic and prevents the query processor from using indexes.
  • Avoid using scalar functions in SELECT statements that return many rows of data. Because the scalar function must be applied to every row, the resulting behavior is like row-based processing and degrades performance.
  • Avoid the use of SELECT *. Instead, specify the required column names. This can prevent some Database Engine errors that stop procedure execution. For example, a SELECT * statement that returns data from a 12 column table and then inserts that data into a 12 column temporary table will succeed until the number or order of columns in either table is changed.
  • Avoid processing or returning too much data. Narrow the results as early as possible in the procedure code so that any subsequent operations performed by the procedure are done using the smallest data set possible. Send just the essential data to the client application. It is more efficient than sending extra data across the network and forcing the client application to work through unnecessarily large result sets.
  • Use explicit transactions by using BEGIN/END TRANSACTION and keep transactions as short as possible. Longer transactions mean longer record locking and a greater potential for deadlocking.
  • Use the Transact-SQL TRY…CATCH feature for error handling inside a procedure. TRY…CATCH can encapsulate an entire block of Transact-SQL statements. This not only creates less performance overhead, it also makes error reporting more accurate with significantly less programming.
  • Use the DEFAULT keyword on all table columns that are referenced by CREATE TABLE or ALTER TABLE Transact-SQL statements in the body of the procedure. This will prevent passing NULL to columns that do not allow null values.
  • Use NULL or NOT NULL for each column in a temporary table. The ANSI_DFLT_ON and ANSI_DFLT_OFF options control the way the Database Engine assigns the NULL or NOT NULL attributes to columns when these attributes are not specified in a CREATE TABLE or ALTER TABLE statement. If a connection executes a procedure with different settings for these options than the connection that created the procedure, the columns of the table created for the second connection can have different nullability and exhibit different behavior. If NULL or NOT NULL is explicitly stated for each column, the temporary tables are created by using the same nullability for all connections that execute the procedure.
  • Use modification statements that convert nulls and include logic that eliminates rows with null values from queries. Be aware that in Transact-SQL, NULL is not an empty or “nothing” value. It is a placeholder for an unknown value and can cause unexpected behavior, especially when querying for result sets or using AGGREGATE functions.
  • Use the UNION ALL operator instead of the UNION or OR operators, unless there is a specific need for distinct values. The UNION ALL operator requires less processing overhead because duplicates are not filtered out of the result set.

viernes, 9 de octubre de 2015

Objetos COM


Para la generacion del COM y su utilizacion en VB estos links son utiles como guias de como hacerlo y resolver problemas en el proceso.



  • Guias para crear un COM en C#:


http://www.codeproject.com/Articles/7587/Exposing-COM-interfaces-of-a-NET-class-library-for

http://www.geeksengine.com/article/create-dll.html

http://www.c-sharpcorner.com/UploadFile/yougerthen/how-to-create-a-com-object-using-vs-2008-and-consume-it-from-vb-6-0-client-application-part-ii/

https://msdn.microsoft.com/en-us/library/c3fd4a20.aspx

http://www.codeproject.com/Articles/18939/C-Com



  • Registrar un COM

http://edndoc.esri.com/arcobjects/9.2/NET/9826f81b-278c-49cc-a912-ab8d86f5e91e.htm

http://resources.esri.com/help/9.3/arcgisengine/dotnet/9826f81b-278c-49cc-a912-ab8d86f5e91e.htm

-> Solucion error de Active X cannot create... y Error Automator VB6

cd C:\Windows\Microsoft.NET\Framework\v4.0.30319

regasm "C:\Windows\System32\AGT_Libreria.dll" /tlb AGT_Libreria.tlb /codebase AGT_Libreria.dll

-> Solucion Can't create object en VB6

Creacion de un objeto con el COM 

Dim Obj As AGT_Libreria.class

Dim Obj = New AGT_Libreria.class
ó
Dim Obj = CreateObject("AGT_Libreria.class")



  • Configuracion del WCF en el caso de no poder utilizar el config file.
https://msdn.microsoft.com/en-us/library/ff648505.aspx

http://www.c-sharpcorner.com/UploadFile/4d9083/how-to-create-basic-http-binding-in-wcf/

http://www.experts-exchange.com/articles/3179/COM-Calling-WCF.html


  • Agregar la referencia en VB6
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683936(v=vs.85).aspx



  • Publicar el WCF en el IIS
Publish a travez de VS y una vez generado registrarlo como una aplicacion en IIS

https://www.youtube.com/watch?v=ztMHiHufEyA

https://msdn.microsoft.com/en-us/library/ms733766(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/aa751792(v=vs.110).aspx

http://www.c-sharpcorner.com/uploadfile/anavijai/hosting-wcf-service-inside-iis/






miércoles, 23 de septiembre de 2015

Instalacion de Spiceworks


1. Crear una VM en azure, tipo A1 (recomendado), Windows Server 2012 R2.

2. Abrir en los endpoints un puerto con el protocolo TCP numero 8754

2. Descargar Spiceworks desde la pagina oficial, se crea una cuenta que sera el admin de la aplicacion para poder descargar el software

3. Se instala en el server, con el unico cuidado que en la primera pantalla nos pide un puerto y hay que cambiarlo por el 8754.

4. Una vez instalado ingresar a la aplicacion por primera vez con la cuenta que se descargo el software.

5. Una vez montado para la configuracion de los backups automaticos se realiza en:

Configurations -> Help Desk Settining -> en el filtro Settings ->  backup configuration

En esa pantalla ya se configura con cuanta frecuencia se realizan, y en donde se van a realizar los backups.


-> Correo:
 
User: soporteproducto@agt.cr
Pass: Audinet2020
 
-> Cuenta SpiceWorks
 
User: agtcrproducto@gmail.com
Pass: AlfaGroupTecnologias

jueves, 23 de julio de 2015

Firma Digital technus

Desarrollo 23/07/2015:
Actualmente Technus soporta la firma digital en formato CAdES XL, XAdES XL (OfficeXML Files) y es requerido implementar el formato PAdES LTV (Solo para PDF)

Antecedentes:
1.     El que emite las políticas para firma digital es el MICIT
2.     Aunque SUGEF siempre ha aceptado ambos formatos, solo había dado guías para firmar en CAdES XL tanto para Xolido como para Adober Reader DC por un problema de este último con el formato PAdES. A inicios del 2015 el MICIT saco la guía para firmar PAdES para ambos programas.
3.     Link para descargar la guía para firmar con Adobe Reader DC al día de hoy 23/07/2015 con PAdES: https://drive.google.com/file/d/0B0RqkCzhufArZDVPaGxsQ2RBdzg/view?usp=sharing. Esto se requeriere para poder firmar documento como lo hacen en SUGEF y poder probar Technus.
4.     Estas guías son actualizadas constantemente para buscar la actual se puede encontrar en la página del Banco Central o en esta referencia: http://www.sugeval.fi.cr/serviciosytramites/Paginas/ConfiguracionFirmaDigitalAvanzada.aspx



Para implementar esta librería hay que modificar las librerías AGT.SecureDocuments que a su vez utilizan las librerías de SecureBlackbox que se puede descargar en https://www.eldos.com/sbb/ . Estas librerías son de paga, pero se puede usar en modo trial “eternamente” porque las validaciones son por sesión. Al menos con la versión que tenemos descarga, me pareció leer que con las versiones nuevas eso cambio. El instalador de la versión que se utiliza esta en AGTSecureDocuments\Requisitos del control de fuentes. Con la descarga de esta libreria se adjuntan muchos de ejemplos que son los que se deben de usar como referencia.


miércoles, 8 de julio de 2015

Entity Framework

En el caso de que se ocupe agregar una tabla que consta de solo columnas foráneas al diagrama del entity framework, y el diagrama solo lo este agregando como una asociación entre tablas en lugar de una tabla en si, habría que agregar una columna provisional en esa tabla por base de datos y agregar de nuevo la tabla para que lo detecte realmente como una tabla, una vez ingresada con las relaciones hacia las demás tablas, se volvería a eliminar la columna en la base de datos y en el diagrama del entity framework y volver a refrescar el diagrama para que ya quede correctamente.