Saturday, September 12, 2009

วัดร่องขุน - เชียงราย


ไม่รู้ว่าเคยไปวัดร่องขุ่น มาหรือยังครับ


more my photo on


http://groovytrip.blogspot.com/2011_04_01_archive.html





การ encode ข้อมูล ด้วย groovy

ตัวอย่าง การ encode ข้อมูล

def outFile = new File('out2.txt')
outFile.delete()
datafile = new File('out.txt')
datafile.eachLine{ line ->
for (c in line) {
outFile.append( (char) ((int)c+1) )
}
outFile.append ('\n')
}
input (out.txt)
--------
This is a boy.
This is a girl.

output (out2.txt)
---------
Uijt!jt!b!cpz/
Uijt!jt!b!hjsm/

การ decode ข้อมูล ก็สามารถทำได้ไม่ยาก เหมือนกันลองไปทำดูครับ

เกี่ยวกับ file ใน groovy

ตัวอย่างการสร้างไฟล์ และ อ่านไฟล์ใน groovy

การสร้าง file

def outFile = new File('out.txt')
outFile.delete() // if file exist, delete it
def i = 1
4.times{ // 4 time loop
outFile.append i++ + '\n'
}


การอ่าน file

datafile = new File('out.txt')
datafile.eachLine{ line -> print line + '\n' } // closure

ตัวอย่าง การใช้งาน VMWare ESX Server

ดูจากรูปนี้แล้ว
XpressHost™ - Vmware ESX Server
VMware มันวางอยู่บน Hardware ชุดเดียวกัน สมมุติว่า มี CPU อยู่ 8 ตัว แบ่ง 4 ตัวให้ SQL server(Windows) และ อีก 4 ตัว ให้ Web server (Unix) นี่คงเป็นวิธีการที่ ทำให้ Database Server กับ Web Server ทำงานอยู่ใกล้กันมากที่สุด (อยู่บน Hardware ชุดเดียวกัน) เพื่อประสิทธิภาพสูง ในการทำงาน

คำแนะนำในการศึกษา Grails

ถ้าคุณเคยใช้จาวา การใช้ Groovy คุณต้องเข้าใจเรื่องต่อไปนี้ closures maps และ properties อ่านตรงนี้
และ เรื่อง MVC, GORM, Filters and Services, GSP และ conf

กรณีการ insert ข้อมูลใน Grails แล้ว OutOfMemoryError

แสดงตัวอย่างการ insert ข้อมูลจำนวนมากใน Grails แล้วจะช้ามาก และจะเกิด OutOfMemoryError สามารถแก้ไขโดยการsessionFactory.getCurrentSession().clear(); ตามลิงค์นี้
Grails, Inserting lots of data using withTransaction results in OutOfMemoryError

การใช้ Batch ใน Grails

การใช้ Block-Level และ Method Level Transaction ใน Grails
Transaction & Batch-processing in Grails

เริ่มต้นการใช้งาน blog แรก และ groovy

บางครั้งเคยเจอ ลิงค์่ที่น่าสนใจ แต่ไม่รู้จะเก็บไว้ไหน ก็เลยมาเก็บไว้ตรงนี้ เดี๋ยวปล่อยไว้นานจะหาไม่เจออีก น่าเสียดาย

วิธีติดตั้งการใช้งาน groovy
http://groovy.codehaus.org/Installing+Groovy

การใช้งาน groovy เบี้องต้น
http://www.javalobby.org/articles/groovy-intro1/