ติดตั้ง webdav ให้ได้ก่อนตามนี้
https://www.digitalocean.com/community/articles/how-to-configure-webdav-access-with-apache-on-ubuntu-12-04
หลังจากนั้นค่อยติดตั้ง Git Server ตามนี้
http://blog.bobbyallen.me/2012/07/23/installing-a-git-server-using-apache-webdav-on-ubuntu-server-12-04/
วันพุธที่ 19 กุมภาพันธ์ พ.ศ. 2557
วันอาทิตย์ที่ 21 ตุลาคม พ.ศ. 2555
Change skin of Chrome developer tools
เปลี่ยน Skin ให้ Chrome Developer Tools
1) เปิด Chrome's user stylesheet's directory
Windows: "C:\Users\**Your username**\AppData\Local\Google\Chrome\User Data\Default\User StyleSheets\"
Mac: "~/Library/Application Support/Google/Chrome/Default/User StyleSheets/"
Linux: "~/.config/chrome/Default/User StyleSheets/"2) Download Skin : Ruby Blue
3) วาง Custom.css ทับของเดิม
ทีมา : https://plus.google.com/115133653231679625609/posts/UZF34wPJXsL
วันพุธที่ 13 มิถุนายน พ.ศ. 2555
Rails : Error omniauth + rack
Error following below
[FATAL]
NoMethodError (undefined method `include?' for nil:NilClass):
omniauth (1.1.0) lib/omniauth/builder.rb:47:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.0) lib/rack/etag.rb:23:in `call'
....
Solution
fixed in gem with rack, '~> 1.4.0'
วันอังคารที่ 3 เมษายน พ.ศ. 2555
rails 3: Rails logger outside controller and model
ทำอย่างไร ถ้าต้องการเขียน log นอก controller และ model ?
ใช้ Rails.logger.info "Some debugging info I want to see in my development log."
วันพุธที่ 28 มีนาคม พ.ศ. 2555
Rails3: How to config rails project no database ?
มีวิธีทำให้ Rails Project ไม่ต้องใช้ database อย่างไร
ใน config/application.rb ให้ comment #require 'rails/all'
ใน config/environments/development.rb ให้ comment #config.active_record.xxxxxxx...
และให้เพิ่ม code ข้างล่างนี้แทนที่
ใน config/application.rb ให้ comment #require 'rails/all'
ใน config/environments/development.rb ให้ comment #config.active_record.xxxxxxx...
และให้เพิ่ม code ข้างล่างนี้แทนที่
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
require "sprockets/railtie"อ้างอิง : http://stackoverflow.com/questions/3954307/rails-3-how-do-i-avoid-database-altogetherวันอังคารที่ 27 มีนาคม พ.ศ. 2555
Mysql : gem install mysql2 on windows
How to gem install mysql with reference connector ibrary ?
- Download mysql-connector-c-noinstall-xxxxxxxxx , วางไว้ที่ c:\
gem install mysql2 --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-xxxxxxxx
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
Rails : Formatting a date in a SQL query in Rails
ต้องการส่งวันที่และเวลา เข้าไปใน SQL Query ?
User.where("created_at < ?", Time.now.to_formatted_s(:db))
User.where("created_at < ?", Time.now.to_formatted_s(:db))
วันอาทิตย์ที่ 25 มีนาคม พ.ศ. 2555
Update SVN Client แล้วพอ Synchronize มีข้อความขึ้นว่า ...Working copy is too old !
Update SVN Client เป็น version ใหม่ แต่พอไป Synchronize Project มี error ว่า ...Working copy is too old (format 10, created by Subversion 1.6) ?
แก้ไขโดยวิธีแค่เลือก Upgrade working copy ก่อน แล้วค่อย Synchronize Project อีกรอบใช้งานได้ทันที
อ้างอิง
วันเสาร์ที่ 24 มีนาคม พ.ศ. 2555
Windows 7 + Epson LQ 300
ต้องการติดตั้ง driver printer Epson LQ 300 บน Windows 7 ?
ขั้นตอนการติดตั้ง
ขั้นตอนการติดตั้ง
- ติดตั้งโดยใช้ Driver ที่มีมากับ Windows 7 เลือกเป็น EPSON LQ-300+ /II ESC/P 2
- ทดสอบพิมพ์ด้วย Print Test Page จะพบปัญหาขึ้น @EJL 1284.4 @ EJL ขี้นที่มุมซ้ายมือบนหัวกระดาษ
- จากรายละเอียดใน Printer Test Page ให้สังเกตที่หัวข้อ Data file: (EP7MDL00.GDP) และในหัวข้อ Additional files used by this driver: สังเกตที่อยู่ของ driver ที่ได้ติดตั้งไป (c:\windows\system32\spool\DRIVERS\x64\3\....)
- ให้เปิดไฟล์ EP7MDL00.GDP ขึ้นมาแก้ไข
- ค้นหาคำว่า @EJL จากนั้นให้ทำการแก้ไข จากบรรทัดบนเป็นบรรทัดล่าง โดยลบ @EJL 1284.4 และ @EJL ออก (ระวังติดสิทธิเกี่ยวกับ file permission)*Cmd: "<0000001B01>@EJL 1284.4<0A>@EJL <0A1B>@*Cmd: "<0000001B01><0A><0A1B>@
- บันทึกไฟล์ และทำการ restart เครื่อง
- ทดสอบพิมพ์ เป็นอันจบการติดตั้ง
อ้างอิง :
วันอาทิตย์ที่ 11 ธันวาคม พ.ศ. 2554
rails 3: How to get the old value of an attribute in Rails
Q: อยากจะได้ค่าก่อนหน้าของแต่ละ attribute ทำอย่างไร เพื่อไว้เปรียบเทียบค่าเก่า ค่าใหม่ ?
A: ให้เพิ่ม _was ต่อท้ายใน attribute นัั้นๆ ได้เลย ก็จะแสดงค่าก่อนหน้ามาให้
A: ให้เพิ่ม _was ต่อท้ายใน attribute นัั้นๆ ได้เลย ก็จะแสดงค่าก่อนหน้ามาให้
วันอังคารที่ 6 กันยายน พ.ศ. 2554
Excel : แทนค่า 0 ด้วยช่องว่าง
Problem : พอดี cell นั้นใช้สูตร copy มาจาก cell อื่น (=A2) แต่ cell ที่ถูกอ้าง (A2) เป็นค่าว่าง ผลลัพธ์ที่ cell ที่อ้างจึงมีค่าเป็น 0 แต่อยากจะให้แสดงเป็นค่าว่างเหมือนกัน
Solution : คลิกขวา cell ที่่อ้าง เลือก format cells ที่ Tab แรก Number ช่อง Category เลือก Custom ในช่อง Type พิมพ์ 0;-0;;@
วันอาทิตย์ที่ 28 สิงหาคม พ.ศ. 2554
rails 3: Rails Footnotes
1. gem 'rails-footnotes', '>= 3.7', :group => :development
2. create footnotes.rb in initializers
3. insert code :
if defined?(Footnotes) && Rails.env.development?Footnotes.run! # first of all# ... other init codeFootnotes::Filter.prefix = 'mvim://open?url=file://%s&line=%d&column=%d'end
วันพฤหัสบดีที่ 18 สิงหาคม พ.ศ. 2554
rails 3: query_reviewer
วันอังคารที่ 28 มิถุนายน พ.ศ. 2554
Rails 3: load schema to production environment
- Development Environment : rake db:schema:dump
- Production Environment : rake db:schema:load RAILS_ENV=production
วันพฤหัสบดีที่ 2 มิถุนายน พ.ศ. 2554
วันศุกร์ที่ 20 พฤษภาคม พ.ศ. 2554
Windows : มารู้จักกับ CAL (Client Access License)
สิทธิการเข้าใช้งานเซิร์ฟเวอร์, เซิร์ฟเวอร์/CAL และ โปรเซสเซอร์ (Server Licensing Models – Operating Systems, Server/CAL และ Per Processor) ผลิตภัณฑ์เซิร์ฟเวอร์ทั้งแบบระบบปฏิบัติการบนเซิร์ฟเวอร์และเซิร์ฟเวอร์/CAL นั้นท่านสามารถติดตั้งซอฟต์แวร์บนเซิร์ฟเวอร์นั้นๆ พร้อมทั้งจัดหาสิทธิการเข้าใช้งานเซิร์ฟเวอร์ (Client Access License หรือ CAL)ซึ่งมีทั้งแบบต่ออุปกรณ์และต่อผู้ใช้ พร้อมทั้งสิทธิการเชื่อมต่อสำหรับบุคคลภายนอกถ้ามี (External Connector หรือ EC) ซึ่งหนึ่งลิขสิทธิ์ของ EC ให้สิทธิเข้าใช้งานไม่จำกัดจำนวนเครื่องหรือผู้ใช้งานต่อเซิร์ฟเวอร์ โดยบุคคลภายนอกในแง่ลิขสิทธิ์นั้นไม่รวมถึงพนักงานที่อยู่นอกออฟฟิสหรือพนักงานชั่วคราว
วันศุกร์ที่ 1 เมษายน พ.ศ. 2554
rails 3: foreign key in migration
class ExampleMigration < ActiveRecord::Migration def self.upcreate_table :products do |t|end
t.references :category
end
#add a foreign key
execute <<-SQL ALTER TABLE products ADD CONSTRAINT fk_products_categories FOREIGN KEY (category_id) REFERENCES categories(id) SQL add_column :users, :home_page_url, :string rename_column :users, :email, :email_address
def self.downrename_column :users, :email_address, :emailend
remove_column :users, :home_page_url
execute "ALTER TABLE products DROP FOREIGN KEY fk_products_categories"
drop_table :products
rails 3 : rake command on environment .
ใช้ parameter ที่ชื่อว่า RAILS_ENV ส่งค่าตาม environment ที่ต้องการตามตัวอย่างนี้
rake db:create RAILS_ENV=test
rake db:migrate RAILS_ENV=test
rake db:drop RAILS_ENV=test
rake db:create RAILS_ENV=test
rake db:migrate RAILS_ENV=test
rake db:drop RAILS_ENV=test
วันอาทิตย์ที่ 13 มีนาคม พ.ศ. 2554
ruby: Can I set primary key in model ?
ให้ใช้ options hash ที่มี key ที่ชื่อว่า :primary_key ตามตัวอย่าง
create_table :countries ,:primary_key => :code do |t|
t.string :code, :limit => 2, :null => false
t.string :iso_a3, :limit => 3, :null => false
t.string :name, :null => false
t.timestamps
end
วันอังคารที่ 22 กุมภาพันธ์ พ.ศ. 2554
ruby: Failed to build the native extension in Ruby
ปัญหา
ถ้ามี error : Failed to build the native extension in Ruby หลังจากใช้ gem insatllแก้ไข
ใช้ DevKit เพื่อแก้ไข ตามลิงก์นี้เลย https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
สมัครสมาชิก:
บทความ (Atom)


