JAXBContext jaxbContext = JAXBContext.newInstance(MyClass.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty("com.sun.xml.internal.bind.characterEscapeHandler", new CharacterEscapeHandler() {
@Override
public void escape(char[] ac, int i, int j, boolean flag, Writer writer) throws IOException {
writer.write(ac, i, j);
}
});
/** | |
* Simple build metadata from system. | |
* | |
* To populate application version, just give following parameter while generation WAR package on grails CLI. | |
* | |
* $ grails "set-version 1.4" "clean" "war myproject.war" | |
* | |
* '1.4' is just an example for build version. If you want to auto generate it by your CI such as Jenkins, then | |
* create an environment variable and pass it to CLI command. | |
* |
class MyController { | |
/** | |
* Normally, String type method name in except part of beforeInterceptor is legal. For example: | |
* | |
* def beforeInterceptor = [action: this.&intercept, except: ['index', 'hede', 'hodo']] | |
* | |
* But this is not safe for future naming refactorings. Instead, using closure-maker | |
* ampersand operator(.&) before method name and then getting 'method' property to get | |
* method name as String is better for future safe changes. |
If you want to use a variable value as key of your map, then you should wrap your key with parenthesis. It makes key to be considered as expression instead of String literal.
String keyVar = "mykey"
def map0 = [keyVar : 12]
assert map0.keyVar == 12
assert !map0.mykey
TreeMap
, sıralamada kullanmak üzere bizden bir Comparator
nesnesi ister ve bu Comparator
nesnesini bir field üzerinde tutar. Eğer TreeMap nesnesine verilen bu Comparator nesnesi Serializable
değilse serialization esnasında (cache'e yazma gibi) NotSerializableException alınır. Özellikle anonim sınıf üzerinden oluşturulan Comparator nesnelerine dikkat etmek gerekir.
Çözüm, Comparator
sınıfını Serializable
olarak işaretlemektir. Anonim olarak oluşturulan Comparator yerine top-level (ayrı sınıf) biçiminde Comparator oluşturup Serializable interface'i ile bu sınıfı Serializable olarak işaretleyebiliriz.
SELECT
MIN(NVL(t.column, 0))
FROM TABLE t
WHERE t.OTHERTABLE_ID = 1234
AND t.Condition = 1;
Eğer Condition
koşulunu sağlayan herhangi bir satır bulunamazsa bu durumda MIN fonksiyonu null
döner.
Bunu engellemek için MIN'i NVL ile sarmak faydalı olabilir.
find . -name '*.pyc' -delete |
find . -cmin -20 -delete |
Today i have decided to write some unit test on JavaScript via Jasmine, but i encountered the following exception stack trace.
Traceback (most recent call last):
File "/usr/local/bin/jasmine", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
git branch --contains COMMIT_SHA1