Paco Zarate
Tecnilogiando
Tecnilogiando
Apr 18th
One of the problems when you want to structure a project on Grails is that the dependent groovy/java projects have to be configured using Maven/Ivy as artifacts, not directly from the Eclipse IDE.
I wanted to use the source directly from Eclipse so I could debug the dependency directly, and that the changes on them would be loaded automatically with Grails (one of the great things on grails is that when you change the source code and save the file it reloads the class file automatically).
This is a little trickier and could not work on newest Eclipse versions but it works fine since a year ago and it works with STS/GTS 3.2.
It uses the ability of Eclipse to define an internal link to another source folder. I guess that you can use the symbolic link directly on the operative system to get the same results but I like that the control is inside Eclipse (windows has symbolic links since windows 7, look at mklink command).
The code for this post is in: Github link
Versions used:
Grails – 1.2.2
Groovy – 2.1
Groovy Grails ToolSuite 3.2
I assume you have:
A) A Grails Project
B) A Java dependency project or
C) A Groovy dependency project
I have configured the a SampleGrails, SampleGroovy (Dependency) and SampleJava (Dependency)

Also there is a
SampleGroovyClass
With a member attribute: memberGroovyAttribute

and
SampleJavaClass
With a member attribute: memberJavaAttribute

Then in Grails the dependencies will be configured:
a) Right Click the Grails project and then choose Properties.
b) Go to Java Build Path in the left panel
c) Go to Source tab
d) Choose the dependent projects as Links:



e) CRITICAL STEP
This is a very important one you need to change the Source target to be:
Project/target/classes
Instead of using Project/target-eclipse/classes
This way when there is a compilation of our dependencies it goes to the classes folder used by the live grails project. It would be better to change this option for the dependencies included.

f) Wait to Grails to refresh the dependencies.
g) The result looks like:

At this moment we can use the Dependencies in the IDE:
I included a new class called GrailsClass inside the original groovy folder:

IMPORTANT NOTE: Autocomplete and hot reload work also!
IMPORTANT NOTE: You can test using a VERY simple Groovy File:
Then I can test it from a Groovy class (one of my favorite testing methods in groovy, add a groovy class, remove everything and type a groovy script, it will be your main method):

I had to run as Groovy Script in Eclipse IDE
If you want to use Grails to be test, then you can modify the index.gsp inside views:

If you run this project using the grails run-app

While running we can change the java and groovy dependencies and the file will be deployed automatically.
There are some limits for this changes on Grails like you cannot change the parameters of a method or add.
Check this link for some limitations: http://www.grails.org/Auto+Reloading
I have found that I need to do restart grails in order to get some changes in the running instance. But it works great when making some little changes and adjustments and you don’t want to wait to stop and start grails.
This is a sample:
I have changed the original Samples from the dependencies to be like this code:
SampleJavaClass.java:

SampleGroovyClass.groovy:

Now we include another method on GrailsClass:

The index.gsp is changed this way:

You can see the result here:

Without stopping grails I will change the values on the dependencies:
SampleJavaClass.java:

SampleGroovyClass.groovy:

And now just reload the web page:

We see the new values we assigned in the dependencies projects (remember that the int value in SampleGroovyClass.groovy is multiplied by itself 3 * 3 = 9).
Finally I want to include some alternatives to use groovy code in a gsp file, so we can remember how easy is to include the Groovy or Java variables and expressions in this kind of files:

This tutorial allows you to use External Dependencies from Java or Groovy inside Grails using Source Directory links feature from Eclipse.
You can use autocomplete from the editor when using classes from the dependencies.
You can use debugger in the source code of the dependency and have the breakpoints working there.
You can modify the files in the dependency and have Grails auto reloading them.
You can access the sample code here: GitHub project
When you will generate your deployment version it is important to backup your solution, then remove the linked folders , generate the jar files for each of the dependencies and include them manually or using Maven or Ivy on the master project. Be careful when doing the removal process to avoid deleting the contents from the disk (have a backup or use your versioning solution).
Mar 3rd
Puedes correr:
Windows – Ejecutar… – cmd
Teclear
slmgr.vbs /dli
Jul 13th
Para poder acceder Bases de datos de Microsip, es necesario tener configurado el Firebird en nuestro Visual Studio 2010.
Este tip es solo para Visual Studio en sus versiones comerciales, no funciona en la versión Express
Se necesita descargar dos programas de la página de firebird:
En la sección de .Net Provider, http://www.firebirdsql.org/en/net-provider/ hay que descargar:
* Firebird ADO.NET Data Provider downloads A la fecha del artículo, la más actual es la version 2.7.7 for .NET 4.0/3.5/2.0 with Entity Framework support (http://sourceforge.net/projects/firebird/files/firebird-net-provider/2.7.7/NETProvider-2.7.7.msi/download)
y
* DDEX Provider for Visual Studio downloads A la fecha del artículo es Version 2.0.5 for Visual Studio 2005/2008/2010. (http://sourceforge.net/projects/firebird/files/firebird-net-provider/DDEX%202.0.5/FirebirdDDEXProvider-2.0.5.zip/download)
El Firebird ADO.NET Data provider es bastante sencillo, solo dan doble click en el NETPRovider-2.7.7.msi y le van dando siguiente al wizard.
El truco para integrar en el visual studio 2010 es que tras instalar hay que registrarlo en el gac.
Utilizando el simbolo del sistema que se incluye en Visual Studio Tools que esta en "inicio – todos los programas – Microsoft Visual Studio 2010"
dar
cd C:\Program Files (x86)\FirebirdClient
No importa si tu windows esta en español.
luego ejecutar
gacutil /i FirebirdSql.Data.FirebirdClient.dll
tras esto ejecutar
gacutil /l FirebirdSql.Data.FirebirdClient
Y anotar la salida. Es importante ejecutar este segundo comando sin el .dll
La salida de ejemplo es:
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.The Global Assembly Cache contains the following assemblies:
FirebirdSql.Data.FirebirdClient, Version=2.7.7.0, Culture=neutral, PublicKeyTo
ken=3750abcc3150b00c, processorArchitecture=MSILNumber of items = 1
Puse en rojo lo mas importante (Version, Culture, PublicKeyToken.
Este también tiene truco para instalar.
Hay que descomprimir el archivo FirebirdDDEXProvider-2.0.5.zip en una carpeta que ustedes no vayan a borrar. Estos archivos deben quedar en esa carpeta y no moverse.
En mi ejemplo usaré c:\firebird
Una vez que los archivos se hayan descomprimido hay que ir un archivo llamado machine.config. Es importante modificar el de la versión de 32 bits (la carpeta Framework sin el 64 en la ruta de config del Windows)..
En mi Windows, el archivo machine.config está dentro de: C:\windows\Microsoft.NET\Framework\v4.0.30319\Config
Noten que la carpeta Framework no trae el 64 al final y que estoy haciendo la configuración para .NET Framework 4.
En ese archivo se debe modificar como sigue:
En la sección
<configuration>
<configSections>
[...]
<section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
[...]
</configSections>
La parte en rojo hay que incluirla en el archivo. Más adelante hay que incluir la siguiente configuración:
<system.data>
<DbProviderFactories>
[...]
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.7.7.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
[...]
</DbProviderFactories>
</system.data>
Noten como configuré los valores de Version, Culture y PublicKeyToken iguales a los que más arriba obtuve del gacutil /l
Ahora viene el registro.
Hay que ir a la carpeta c:\firebird\FirebirdDDEXProvider-2.0.5\reg_files\VS2010 y abrir el archivo que se llama FirebirdDDEXProvider32.reg (si su windows es de 32 bits) o FirebirdDDEXProvider64.reg (si su windows es de 64 bits) y hay que buscar la palabra %Path%
Borran esa parabra y ponen la ruta donde están los archivos FirebirdSql.VisualStudio.DataTools.dll y FirebirdSql.VisualStudio.DataToolsUI.dll. (Que forman parte del zip FirebirdDDEXProvider-2.0.5.zip)
En mi caso estaba así:
"CodeBase"="%Path%\\FirebirdSql.VisualStudio.DataTools.dll"
y la cambie a:
"CodeBase"="C:\\Firebird\\FirebirdDDEXProvider-2.0.5\\FirebirdSql.VisualStudio.DataTools.dll"
La Parte en Rojo es la que inclui. Ojo los dobles backslash "\\" son intencionales, pues "escapan" el caracter "\".
Ahora ejecuten con doble click el archivo .reg que modificaron y listo.
OJO: Hay unos archivos especiales si ustedes usan el SDK de Visual Studio (que rara vez he visto).
Ya solo ejecutan el visual studio 2010, en la sección de servidores al Agregar conexion, pueden cambiar el data source (fuente de datos) y seleccionar Firebird Data Source:


Nos va a presentar entonces la pantalla para capturar la información de la base de datos y conexión:

Con Test Connection podemos probar la conexión:

Vemos que la conexión fue exitosa, finalmente le damos OK y luego revisamos en el Server Manager nuestras tablas:

Y con eso concluimos este tutorial.
May 3rd
El problema que tenemos hoy es un tanto complejo. Tenía un servidor con openldap y una base de datos Berkeley DB (BDB) con versión 4.8, luego instalé la versión más reciente del CentOS 6.2 pero el openldap tenía una versión Berkeley DB (DBD) 4.7.
Copie la carpeta del ldap al Centos 6.2 y el error que me marcaba al tratar de hacer el:
slapcat -l infoexportada.ldif
era:
db_stat: Program version 4.7 doesn't match environment version 4.8
db_stat: DB_ENV->open: DB_VERSION_MISMATCH: Database environment version mismatch
Por lo que podía ver que los datos (environment version) era 4.8 mientras que el ldap tenía una versión 4.7.
Ojo: El ldap es quien tiene la librería de BDB embebida. Eso depende de cómo fue compilado, en este caso el openldap de Centos está compilado contra BDB 4.7.
No hice un respaldo con slapcat de la base de datos anterior por lo que necesitaba extraer la información directamente del BDB, sin embargo esto no es trivial por lo que decidí intentar instalar en Mint el OpenLdap que efectivamente está funcionando con 4.8 PERO el problema es que luego mandaba un segundo error:
bdb(here goes the dc from our site): Build signature doesn't match environment This is because my BDB version has another build signature. La solucion fue hacer un respaldo de mi carpeta de datos remover los archivos que empiezan con __db cp -R ldapDB ldapDB.bak cd ldapDB rm -f __db.* en mi carpeta de la base de datos de ldap (ldapDB). Luego ya funcionó el slapcat: slapcat -l backup.ldif -f slapd.conf
Referencias:
http://lists.fedoraproject.org/pipermail/devel/2010-November/146104.html
May 3rd
Recientemente nos dimos a la tarea de compilar el openldap en mint.
Las instrucciones deben ser iguales para ubuntu:
- Usando synaptic instalar los prerequisitos:
openssl
gnutls
binutils
make
linux-headers-3.0.0-12
La version de linux headers a instalar se obtiene con uname -r que dice la version actual.
libnss3
libnss3-dev
libnspr4
libnspr4-dev
libdb4.8 (OJO: yo use este paquete pues queria la recuperacion de unos archivos con formato 4.8 pero debe poderse instalar una version 5 del dbd)
libdb4.8-dev
Errores que se presentaron:
Error 1: MozNSS not found – please specify the location to the NSPR and NSS header files in CPPFLAGS and the location to the NSPR and NSS libraries in LDFLAGS (if not in the system location)
Esto se corrigio instalando libnss3-dev y libnspr4-dev y ejecutando el configure con:
env CPPFLAGS=-I/usr/include/nss\ -I/usr/include/nspr LDFLAGS=-L/usr/lib/x86_64-linux-gnu/nss ./configure –with-tls
Error 2:
configure: error: BDB/HDB: BerkeleyDB not available
Este se corrigio al instalar el paquete db4.8-dev
Referencias:
http://scriptrunner.posterous.com/openldap-configure-error-bdbhdb-berkeleydb-no
http://ubuntuforums.org/showthread.php?t=1833770
Feb 24th
Esta es fina:
Al instalar SAP Business One en su version 8.8 con SQL Server, no permitia conectar, cuando le daba en change company (cambiar compañía) mostraba todo en blanco y no se podía modificar el servidor y aparecia solo un numero 10.
Esto se corrige de la siguiente manera:
Ir al panel de control, ir a las cuentas de usuario, ir a la ultima opcion:
Cambiar configuración de control de cuentas de usuario (Tambien conocido como UAC)
La barra que hay, hay que ponerla hasta abajo (Nunca notificar).
Reiniciar
Al volver a entrar a SAP Business One Client, el problema se resuelve ymuestra los datos que se esperaba
Si necesitan cambiar el server al que el cliente se conecta, hay que ir al servidor y en el Servicio de Licencias ir a las opcionies de seguridad
Ahi se necesita entrar con el password de B1Siteuser para poder hacer las modificaciones en la configuraciónd e la conexión. Se guardan los datos y listo.
Es importante saber esto porque en el cliente de SAP ya no se configura la conexión, sino que se tiene que hacer en el servidor.
Problem to change server in the client for SAP Business One 8.8:
When using Windows 7, you must deactivate the UAC, go to control panel, user accounts, the last option: change settings for user accounts control and set the bar to bottom (never notify) restart and that is done.
Estas paginas son las que use:
http://forums.sdn.sap.com/thread.jspa?threadID=1735930
http://forums.sdn.sap.com/thread.jspa?threadID=1798149
Ultimo dato si les esta pidiendo el servidor de Licencias, me ha pasado que hay que reiniciar el servicio TAO en el servidor para que se pueda entrar.
Dec 27th
Hola, un comando muy util en windows para hacer algo parecido al grep de unix
(llevaba años buscando algo así)
El comando es find y se puede usar en las redirecciones:
ej:
1.-
netstat -a -n | find "LISTENING"
Este comando muestra los puertos que están siendo servidos en la pc actual.
2.-
systeminfo | find "System Boot Time:"
Este comando dice el momento (fecha y hora) del arranque del sistema.
Saludos!
Dec 12th
Este post es un listado de los firewalls que hemos visto en años y que trabajan bien, sirve para evaluaciones futuras:
Fortinet
Astaro (Parcialmente Open Source)
WebSense
Barracuda
pfSense (open source)
zeroshell (open source)
shorewall (open source)
Untagle (open source)
Dec 12th
Hola,
Aquí dejo algunos shortcuts o accesos rápidos del visual studio que me han parecido interesantes y pueden ayudar a hacer más rápido el trabajo
Ctrl + Enter – Inserta linea arriba
Alt + Enter – Ir a las propiedades
Shift + Alt + Enter
Ctrl + . – Este ayuda a ver el tip tool, ayuda con el rename con refactor (otro obligado!)
Ctrl + M + M – Colapsa region
F2 – Rename
Ctrl + – - Navegación
Shift + Ctrl + – - Navegación
Ctrl + B+ T – Añadir un Bookmark
prop <TAB> <TAB> – Add a property
Ctrl + flechaarriba / Ctrl + flechaabajo – Navega por los métodos
Ctrl + k + s – Snippet
Ctrl + L – Cortar la linea.
Nov 30th
Windows 2008 tiene un nuevo esquema de seguridad, que cuando está activo, no permite la conexión desde el cliente de terminal services de Windows XP.
Para poder hacer el acceso se requieren de dos programas:
1. Actualizar el cliente de RDP del windows XP a uno que acepte el protocolo de Windows RDP 7
http://support.microsoft.com/kb/969084
2. Actualizar la configuración para soportar el CredSSP (que es el nuevo Security Support Provider para Windows 2008).
Esto se hace con el fixit app que se incluye en esta liga:
http://support.microsoft.com/kb/951608
Adicionalmente es posible requerir un par de hotfixes que se encuentran dentro de la siguiente liga:
http://support.microsoft.com/kb/953760
Yo no los necesité, pero es la referencia de donde obtuve una de las ligas de arriba.