gedit และ vim เพื่อการทดแทน textmate
ไม่เคยใช้ mac หรือนะ เลยไม่เคยมี textmate แต่คิดว่า gedit นี่ก็โอเคแล้ว Gmate: http://github.com/lexrupy/gmate/ วิธีลงก็
$ git clone git://github.com/lexrupy/gmate.git $ cd gmate $ sh install.sh
$ git clone git://github.com/akitaonrails/vimfiles.git .vim $cd .vim $ git submodule init $ git submodule update $ cp vimrc ~/.vimrc
git submodule update
Typo consumer too much memory
I monitor this application typo 5.0.2 consume too much memory about 50 – 80 MB which full feature. So i will try to make lite version for typo because I still like it. By the way, If my try is not successful, I will make my own blog system
มันกิน mem มากเหลือเกินไม่ไหว ถ้ามีโอกาศ จะลองทำแบบ lite ดู แต่ถ้าไม่ได้ลองเขียนใช้เองแล้ว ไม่ไหวเปลือง[…]
Typo 5.0.2
เปลี่ยนไปเยอะมาก ทั้ง front end และ back end มีการจัดวางเมนูได้ดีขึ้น ใช้ง่ายขึ้น สามารถ edit theme ได้บางส่วน ที่สำคัญยังเพิ่มระบบ multi user ด้วย ป.ล. ถ้าจะให้ดีทำ ระบบ plugin ให้ง่ายกว่านี้ก็ดีนะ อยากได้ revision เหมือน drupal จะได้เป็น Wiki ได้ด้วย[...]Ultraviolet Hack แบบใช้ไปก่อน
วิธีการก็เอา syntax ที่มีอยู่ใน typo มา hack ซะ ซึ่งมันเป็น macro อยู่แล้ว จาก plugin ชื่อ typo_textfilter_code ก็ copy ทั้ง folder มาเป็นชื่อ typo_textfilter_uvcode จากนั้นก็แก้ทุกอย่างที่เดิมเป็น code ให้เป็น uvcode แล้วก็แก้ไฟล์ typo_textfilter_uvcode/lib/typo_textfilter_uvcode.rb ดังนี้
<typo:uvcode lang="ruby"> def self.macrofilter(blog,content,attrib,params,text="")
lang = attrib['lang'] || "plain_text"
title = attrib['title']
cssclass = attrib['class'] || 'iplastic'
linenumber = attrib['linenumber'] || false
text = text.to_s.gsub(/\r/,'').gsub(/\A\n/,'').chomp
convertor = Uv
text = convertor.parse(text, "xhtml", lang, linenumber, cssclass)
"<div class=\"typocode\">#{text}</div>"
end </typo:uvcode>
จากนั้นก็เอา css จะใช้ไปใส่ที่ public/stylesheets/user-style.css ในนี้เพิ่ม <typo:uvcode lang="css"> overflow: auto; </typo:uvcode> เข้าไปใน class pre [...]
Typo is hebinated
Piers Cawley หนึ่งใน main developer ของ typo ออกมาพูดใน blog ตัวเอง
ถึงการหยุดนิ่งของ typo และยังมีการชมเชย Mephisto ที่มีการทำงานที่ดีกว่า typo ทำให้ developer ทำงานได้ง่ายด้วยการเขียน code ที่สะอาด
แต่ไม่นานมานี้ดูท่าจะมีการเปลี่ยนแปลงครั้งใหญ่กัน typo (และคงอีกหลายๆตัว) กับการมาของ rails 2.0 จะรอดีหรือจะ folk ดี หรือจะเขียนเองดีน้า….
อยากได้ plugin เหมือน jazzy ใน Mephisto ไปถาม punneng ดีกว่า[…]
Redgem Project for Rails Hosting
I’m a ruby programming hobbyist and doing rails hosting in Thailand especially ruby (and rails). Because in Thailand, there is nobody doing rails hosting. In fact, I fall in love with ruby as much as i written. One factor that make ruby grow up, there is a product that can release ruby and rails powers. So I decide to do Control panel for Rails hosting in ruby programming.
This project is base on vhcs2 concept with additional features. I draw some concept of control panel with freemind software
uninitialized constant Flickr::XmlSimple
I call this project name “REDGEM” and now I opening project to rubyforge.org and get approve alrady. It can be accessed to redgem project
For rough concept, I separate work into 2 path
- Web Control Panel – It is written by Ruby on Rails. This part is interacted with user.
- Engine – It is also written by Ruby. The engine has responsibility to edit file configuration and deployment
For Future design, UI it may not be a web, it can be other or other language
As you see this is not easy one to do, I need help. Anyone can help me please let me know.
Thank You
File: redgem concept
ภาษาไทยข้างใน[…]
file_column
พอดีมีทำ upload ทั้งรูปและไฟล์ pdf ด้วย file_column แต่มีการกำหนดไว้ว่าให้ resize รูปที่ขึ้นไป พอ upload pdf ก็เกิดปัญหานะสิเพราะมัน resize ทำ thumbnail ไม่ได้ (ที่จริงก็ได้แต่ยังไงไม่รู้) เพราะมันจะทำให้ WebBrick crash ไป และก็ขี้เกียจไปสร้างอันใหม่
code เดิม
validates_file_format_of :image, :in => ["gif", "jpg", "png","pdf"]
file_column :image, :magick => {
:versions => {
:thumb => {:crop => "1:1",
:size => "50x50!", :name => "thumb"},
}
}ทุกไฟล์ที่ upload มันก็ทำ version ตามที่กำหนดไว้หมด แก้โดย
IMAGE_EXTENSIONS = {
"image/gif" => "gif",
"image/jpg" => "jpg",
"image/png" => "png"
}
OTHER_EXTENSIONS = {
"application/pdf" => "pdf",
"application/msword" => "doc",
"application/zip" => "zip",
"text/plain" => "txt",
"text/xml" => "xml",
"video/mpeg" => "mpeg",
"video/quicktime" => "mov",
}
file_column :image, :magick => {
:options => {:mime_extensions => IMAGE_EXTENSIONS},
:versions => {
:thumb => {:crop => "1:1",
:size => "50x50!", :name => "thumb"},
}
}
file_column( :image,
:options => {:mime_extensions => OTHER_EXTENSIONS})
ทำมันทั้งยังงี้ล่ะ เผื่อไฟล์อื่นจะได้ใช้ได้ด้วย ส่วน validates_file_format_of ก็เพื่มเอาเท่าที่ใช้
ไม่รู้ว่า act_as_attachment จะเป็นไงมั่ง แต่ตอนนี้สำหรับหผม file_column ยังโอเคอยู่
Rails Log
พอดีมีปัญหาเกี่ยวกับ log ใน rails ซึ่งมันก็กินเนื้อที่เยอะพอดูเลยพยามหาวิธีปิดมัน แต่สุดท้ายก็รู้ว่ามันปิดไม่ได้ เพราะ log มันเอาไว้ดูความเคลื่อนไหว ก็เลยได้แต่พยามหาวิธีให้มันเก็บน้อยลง ไปเจอที่ wiki ของ rails สรุปได้ว่า
ActiveRecord จะไปเรียกใช้ class Logger เพื่อจะทำการเก็บ log ลงไฟล์
ใน development จะใช้ :debug
ใน production จะใช้ :info
ซึ่งทั้งหมดก็มี :debug, :info, :warn, :error, :fatal ซึ่ง log class ของ ruby ยังมี :any แต่ไม่ทำงานบน rails ถ้าอยากให้ log น้อยลง เอาเฉพาะที่มี error ก็ใช้ :error
ให้เพิ่ม
config.log_level = :error
ลงในไฟล์
config/environment.rb
หรือถ้าจะปรับแต่งใดๆ ดูได้ที่ wiki ของ rails ครับ[…]

