miércoles, 5 de noviembre de 2014

Google Apps for Work


What is Google Apps?
Google Apps is a cloud-based productivity suite that helps teams communicate, collaborate and get things done from anywhere and on any device. It's simple to set up, use and manage, so your business can focus on what really matters.
Millions of organizations around the world count on Google Apps for professional email, file storage, video meetings, online calendars, document editing and more.
Here are some highlights:
Business email for your domain
Looking professional matters, and that means communicating as you@yourcompany.com. Gmail’s simple, powerful features help you build your brand while getting more done.
Access from any location or device
Check email, share files, edit documents, hold video meetings and more whether you’re at work, at home or in transit. You can pick up where you left off from a computer, tablet or phone.
Enterprise-level management tools
Robust admin settings give you total command over users, devices, security and more. Your data always belongs to you, and it goes with you if you switch solutions.

martes, 19 de julio de 2011

CampusParty - Video - Introducción a Grails (ES)(MX)

Uso de belongsTo y hasMany - Clases de Dominio

Uso de las Clases de Dominio

En Grails un dominio es una clase, ubicada en el directorio: grails-app/domain.
Una clase de dominio se crea con el comando: grails create-domain-class Book.
Se edita el archivo creado con el editor preferido.

ejemplo:
class Book {
 String title
 Date releaseDate
 Author author
}


El nombre de la clase, por defecto, se relacionan con el nombre de tabla en minúsculas y separadas por guiones en lugar de mayúsculas y minúsculas. Mientras que cada propiedad se asigna a las columnas individuales.
Consulte la sección de guía de usuario en GORM  para más información.

  • Creamos un aplicación en Grails
    • abrimos la consola, escribimos el comando
      • grails create-app biblio
    • escribimos el comando cd biblio para entrar a la aplicación


belongsTo

Define una relación de "Pertenece a", donde la clase especificada por belongsTo asume la propiedad de la relación. Esto tiene el efecto de controlar la forma en cascada de eliminaciones. En otras palabras,el lado de ser dueño de eliminaciones en cascada cuando el belongsTo se especifica en el lado inverso.

Creamos la clase de dominio con el comando: grails create-domain-class Book
Se edita el archivo creado con el editor preferido, quedando de la siguiente manera:

ejemplo:
class Book {
   String title
   static belongsTo = [author:Author]
}


Crearemos el controlador de Book con el comando:

grails generate-controller Book
En Grails el controlador esta ubicado en el directorio: grails-app/controller.
quedando de la siguiente manera:
class BookController {
   def scaffold = Book
}


En este ejemplo, la clase de libro se especifica que pertenece a la clase Autor, por lo tanto, cuando una instancia Autor se elimina también todos los casos relacionadoscon el Libro del Autor

hasMany

Define una asociación uno-a-muchos entre dos clases.
Creamos la clase de dominio con el comando: grails create-domain-class Author
Se edita el archivo creado con el editor preferido, quedando de la siguiente manera:

ejemplo:
class Author {
   String name
   static hasMany = [books:Book]
}


Crearemos el controlador de Author con el comando:

grails generate-controller Author
En Grails el controlador esta ubicado en el directorio: grails-app/controller.
quedando de la siguiente manera:
class AuthorController {
   def scaffold = Author
}


En este ejemplo se define una relación de uno a varios entre la clase Autor y de la clase Libro (un autor tiene muchos libros).
Por defecto GORM creará una propiedad de tipo java.util.Set utilizando la clave dentro de la definición del mapa hasMany. Por ejemplo, la definición:

static hasMany = [books:Book]


Corremos la aplicación:
grails run-app

Referencia:

miércoles, 6 de julio de 2011

Constraints Grails

Descripción:
Las restricciones en Grails definen reglas de validación, generación de esquemas y CRUD generación de meta daros. Un ejemplo de conjunto de restricciones aplicadas a una clase de domino son:


blank

Propósito

Validar que el String no esta vació

Ejemplo


login(blank:false)

Descripción

Poner en falso si un valor del string no puede ser vació
Codigo de Error: className.propertyName.blank

creditCard

Purpose

To validate that a String value is a valid credit card number

Examples

cardNumber(creditCard:true)

Description

Set to true if a string should be a credit card number. Internally uses the org.apache.commons.validator.CreditCardValidator class.
Error Code: className.propertyName.creditCard.invalid

email

Purpose

To validate that a String value is a valid email address.

Examples

homeEmail(email:true)

Description

Set to true if a string value is an email address. Internally uses the org.apache.commons.validator.EmailValidator class.
Error Code: className.propertyName.email.invalid

inList

Purpose

To validate that a value is within a range or collection of constrained values.

Examples

name(inList:["Joe", "Fred", "Bob"] )

Description

Constrains a value so that it must be contained within the given list. This constraint influences schema generation.
Error Code: className.propertyName.not.inList

matches

Purpose

To validate that a String value matches a given regular expression.

Examples

login(matches:"[a-zA-Z]+")

Description

Applies a regular expression against a string value.
Error Code: className.propertyName.matches.invalid

max

Purpose

Ensures a value does not exceed the given maximum value.

Examples

age(max:new Date()) 
price(max:999F)

Description

Sets the maximum value of a class that implements java.lang.Comparable. The same type needs to be used as the property itself. This constraint influences schema generation.
Error Code: className.propertyName.max.exceeded

maxSize

Purpose

Ensures a value's size does not exceed the given maximum value.

Examples

children(maxSize:25)

Description

This constraint influences schema generation.
Error Code: className.propertyName.maxSize.exceeded

min

Purpose

Ensures a value does not fall below the given minimum value.

Examples

age(min:new Date()) 
price(min:0F)

Description

Sets the minimum value of a class that implements java.lang.Comparable. The same type needs to be used as the property itself. This constraint influences schema generation.
Error Code: className.propertyName.min.notmet

minSize

Purpose

Ensures a value's size does not fall below the given minimum value.

Examples

children(minSize:25)

Description

Sets the minimum size of a collection or number property. This constraint influences schema generation.
Error Code: className.propertyName.minSize.notmet

notEqual

Purpose

Ensures that a property is not equal to the specified value

Examples

login(notEqual:"Bob")

Description

Error Code: className.propertyName.notEqual

nullable

Purpose

Allows a property to be set to null. By default Grails does not allow null values for properties.

Examples

age(nullable:true)

Description

Set to true if the property allows null values.
Error Code: className.propertyName.nullable

range

Purpose

Uses a Groovy range to ensure that a property's value occurs within a specified range

Examples

age(range:18..65)

Description

Set to a Groovy range which can contain numbers in the form of an IntRange, dates or any object that implements Comparable and providesnext and previous methods for navigation. This constraint influences schema generation.
Error Code: className.propertyName.range.toosmall or className.propertyName.range.toobig

scale

Purpose

Set to the desired scale for floating point numbers (i.e., the number of digits to the right of the decimal point).

Examples

salary(scale:2)

Description

Set to the desired scale for floating point numbers (i.e., the number of digits to the right of the decimal point). This constraint is applicable for properties of the following types: java.lang.Floatjava.lang.Double, and java.math.BigDecimal (and its subclasses). When validation is invoked, this constraint determines if the number includes more nonzero decimal places than the scale permits. If so, it automatically rounds the number to the maximum number of decimal places allowed by the scale. This constraint does not generate validation error messages.
This constraint influences schema generation.
Error Code: N/A

size

Purpose

Uses a Groovy range to restrict the size of a collection or number or the length of a String.

Examples

children(size:5..15)

Description

Sets the size of a collection or number property or String length.
Currently this constraint cannot be used in addition to
blank or nullable, a custom validator may be added to perform this kind of constraints.

This constraint influences schema generation.
Error Code: className.propertyName.size.toosmall or className.propertyName.size.toobig

unique

Purpose

Constraints a property as unique at the database level

Examples

login(unique:true)

Description

Set to true if the property must be unique (this is a persistent call and will query the database)
Scope of unique constraint can be specified by specifying the name of another property of the same class, or list of such names. The semantics in these cases is: pair of constrained property value and scope property value must be unique (or combination of constrained property value and all scope property values must be unique).
Example:
group(unique:'department')
In the above example group name must be unique in one department but there might be groups with same name in different departments.
Another example:
login(unique:['group','department'])
In this example login must be unique in group and department. There might be same logins in different groups or different departments.

url

Purpose

To validate that a String value is a valid URL.

Examples

homePage(url:true)

Description

Set to true if a string value is a URL. Internally uses the org.apache.commons.validator.UrlValidator class.
Error Code: className.propertyName.url.invalid



Referencia:
http://grails.org/doc/1.0.x/

Consola Grails

Descripción:
Este comando carga una interfaz gráfica de usuario donde se pueden escribir comandos de Groovy.

grails console

Groovy Server Pages (.gsp)



Groovy Servers Pages (o GSP para resumir) es la tecnología de vista de Grails. Esta esta diseñada para ser mas familiar para usuarios de tecnologías como ASP y JSP, pero ser aun mas flexible e intuitivo.
En Grails GSPs están en el directorio: grails-app/views.


GSP soporta el uso de bloques <% %> para incrustar código de Groovy (este no se recomienda):



<html>
   <body>
     <%="Hello GSP!" %>
   </body>
</html>




GSP tambien soporta el estilo de comentarioa JSP del lado del servidor, ejemplo:
<body>
  <%-- Este es mi comentario --%>
     <%="Hola GSP!" %>
   </body>
</html>


Variables and Scopes

Con el bloques <% %> se pueden declarar variables:
<% now = new Date() %>
Y entonces re usar esas variables más abajo de la página.
<%=now%>