Creating Grails Custom Constraints

Now and than there is the requirement to create custom constraints. As you might already know, there are plenty of constraints that already are shipped with Grails. Those can be applied in the constraints closure of your domain or command classes:

Continue reading “Creating Grails Custom Constraints” »

Grails-Job Scheduling(Quartz)

หลังที่งงอยู่ตั่งนาน ไอคำว่า Quartz ของจาวาที่เห็นบ่อยๆนั่นหมายถึงอะไร ก็ถึงบางอ้อ มันคือการทำ Job Scheduling นั่นเอง สำหรับ Grails เองก็มี Plug in ให้ใช้ได้เหมือนกัน โดยต้องติดตั่งเพิ่มโดย

$grails install-plugin quartz

โดยสามารถใช้ corn job ได้ด้วย

class MyJob { static triggers = { simple startDelay:10000, repeatInterval: 30000, repeatCount: 10 cron startDelay:10000, cronExpression: ’0/6 * 15 * * ?’ custom triggerClass:MyTriggerClass, myParam:myValue, myAnotherParam:myAnotherValue }   def [...]

JFreeChart Eastwood Plugin

เป็น plugin เพื่อให้เราใช้ google chart ได้โดยไม่ต้องต่อ internet นั่นเอง ดังนั้นก่อนอื่นเราต้องติดตั่ง google chart plugin ก่อน

$grails install-plugin http://plugins.grails.org/grails-google-chart/trunk/grails-google-chart-0.5.0.zip

ย้ำอีกครั้งน่ะครับว่าต้องเป็น version 0.5.0 เท่านั้นน่ะครับ ไม่งั้นจะติดตั่ง eastwood plugin ไม่ได้ครับ หรือว่าลอง เข้าลิ้ง นี้ก็ได้ครับ ผมทำ mirror ไว้

$grails install-plugin http://mirror.jiramot.info/grails/plugin/grails-google-chart-0.5.0.zip

เมื่อทำการติดตั่ง google chart plugin เสร็จแล้ว ก็มาติดตั่ง Eastwood plugin ได้เลยครับ

$grails install-plugin eastwood-chart

หรือใช้ mirror [...]

Grails: acegi security plugin tutotial

เนื่องจากไม่มีอะไรทำ ก็เลยลองนั่งทำเวปแนวๆ twitter แต่เปลี่ยน concept ใหม่ เนื่องจากผมว่าเบื่อที่บางคน twit จนกลายเป็น chatroom ไปกลายๆ ก็เลยทำให้มันเปลี่ยนจากอิง follow จาก user กลายเป็น follow เป็น group ไปแทน

ก็เลยนั่งเขียน grails แล้วในส่วนของการจัดการการ authen ก็เลยใช้ acegi plugin ของ grails เข้ามาช่วย

เริ่มแรกก็ทำการสร้าง Application

# grails create-app bookstore
# cd bookstore

จากนั้นทำการลง plugin

# grails install-plugin acegi

Continue reading “Grails: acegi security plugin tutotial” »

Grails Scaffolding CRUD Templates for Google App Engine / Java

สือเนื่องมาจากที่ Google ได้เปิดตัว App Engine ทีรอบรับภาษา Java จากนั้น Grails ก็ได้ทำการอัพเกรดเป็นเวอร์ชั่น 1.1.1 เพื่อรองรับ GAE ดังกล่าว การใช้ GAE ของ Grails จะใช้ JDO ติดต่อ database ต่างกับที่่เราใช้ Grails โดยปกติซึ่งจะใช้ Hibernate ในการเป็น ORM

ที่มา http://fbflex.wordpress.com/2009/05/07/grails-scaffolding-crud-templates-for-google-app-engine-java/