- Shop API-KEY -> EDGDgFU21pZD6VBpJFMX635y5Gh8vyLYiNAmh2Y5qn7Be3wPp2dNFQ9R
- Platform API-KEY -> ww7Tpkha3jxE6eJgmi74xG89zTWCSh2Pw7wVELC6t7wb6MXE8Bbsjkuj
POST /v2/alfred/purchase
#crear app | |
rails new rottenpotatoes | |
cd rottenpotatoes | |
tree | |
#agregar haml a Gemfile | |
https://gist.github.com/e858c6b1ba260e9b0ecccdebd64cb2d7 | |
bundle install | |
#mirar routes vacias |
/* | |
Anatel Documentation -> http://www.anatel.gov.br/Portal/exibirPortalPaginaEspecial.do?org.apache.struts.taglib.html.TOKEN=9594e1d11fbc996d52bda44e608bb744&codItemCanal=1794&pastaSelecionada=2984 | |
TL;DR: | |
Before 2012-07-29, Brazilian mobile phones where 10 digits long, 2 of them being an area code. e.g.: 11 2222-3333 | |
From then on, they are slowly adding a ninth digit between the area code and the user's number, like this: 11 9 2222-3333 | |
This process will end on 2016-12-31, so if you are reading this after that date, ignore the first method and use the second one. | |
*/ | |
boolean isValidBrazilianMobilePhoneBefore20161231(String phone) { |
I hate it. I simply hate it.
If a Grails parameter is null and you call toString()
on it, it doesn't fail with a good old NullPointerException
like I expected. Instead, what you get is a String with value 'null'.
The only way to get a null value when the param is null, is to use the Groovy Safe Navigation operator.
Therefore:
given:
If you have a Domain class with an assigned id (not the default autoincremented long), the id assignment must not be in the constructor, but in a different line.
That means, having this domain:
class State implements Serializable {
String id
static mapping = {
id column: 'id', generator: 'assigned'
}
This is not Grails fault, but Spring-Loaded's.
They make the assumption that you won't put any of your own code under a package called in certain ways, and caches classes under that packages, which are meant to be used only by the framework. The most significant ones for us are grails.*
and groovy.*
. As a result, if you do use that packages, you will get something like this when trying to reload those classes:
2014-09-26 04:21:20,945 [FileSystemWatcher: files=#100 cl=java.net.URLClassLoader@
19d86dfc] ERROR plugins.AbstractGrailsPluginManager - Plugin [services:2.4.2] could not reload changes to file [/<path to ggts workspace>/ggts-workspace/grails-slow3/grails-app/services/slow/SomeClassService.groovy]: Cannot get property 'cacheOperationSource' on null object
Message: Cannot get property 'cacheOperationSource' on null object
Line | Method
->> 184 | doCall in CacheGrailsPlugin$_closure4
What happens if you look for a config key in a groovy.util.ConfigObject and it does not exist?
It should return null or an empty map. The latter is true.
But the curious thing is that the key is created if it does not exist! It seems pretty odd and useless, but they must have a reason...
Here is the code that does that in this class:
public Object getProperty(String name) {
This seems pretty stupid, but it can happen to anyone.
This, of course, works:
boolean something = true
prinltn "The value of something is: " + something
But, this, strangely (at first) DOES NOT work:
I know it's a dangerous thing, it can generate confusion and unwanted magical happenings, but...
The Groovy Truth is what makes collections evaluate as false when they are null or empty, or Numbers evaluate as false when its value is null or zero and true otherwise.
As with many other operators and defult Groovy methods, you can add this magic to an object of your own. Just by overriding its asBoolean
method.
For example, here is my Order
class.
class Order {
#Grails
##Objetivo Simplifica el desarrollo de aplicaciones Java. Lleva el desarrollo de aplicaciones web al siguiente nivel de abstracción. Construido sobre muchas herramientas que son usadas actualmente y sigue teniendo la flexibilidad para cambiar lo que se desee. Las configuraciones por defecto son usualmente suficientes.
Hibernate | El ORM por default del mundo Java |
Spring | Inversion of Control (IoC) container y framework wrapper |
SiteMesh | Layout-rendering framework |