Hide account on Windows Logon

Posted by batt | Posted in Windows | Posted on 22-04-2011

0

Run => regedit

ด้านซ้ายเลือกไปที่ => HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList

ด้านขวามือ ให้คลิกขวาบริเวณพื้นที่ว่างคลิก New คลิก DWORD value ตั้งชื่อเป็นให้เป็นชื่อของ account ที่ต้องการซ่อน

*** ใช้ได้ทั้ง Windows XP, Windows Vista, Windows 7

จากใจนักออกแบบ

Posted by batt | Posted in FWD Mail, Uncategorized | Posted on 08-04-2011

0

ไข่ต้มรูปหัวใจ

Posted by batt | Posted in FWD Mail, Uncategorized | Posted on 03-04-2011

0

ไข่ต้มรูปหัวใจ สำหรับคู่ข้าวใหม่ปลามัน ไข่ต้มรูปหัวใจ สำหรับคู่ข้าวใหม่ปลามัน

เตรียม ต้มไข่ให้สุก แล้วแช่น้ำไว้สักพัก(จะได้ไม่ร้อนมือ) แล้วนำไปปอกเปลือก

อ่านต่อที่นี่ => http://www.shopat7.com/index.php?lay=show&ac=article&Id=539312081&Ntype=2

ละครไทยหัวใจเกาหลี

Posted by batt | Posted in FWD Mail, Uncategorized | Posted on 02-04-2011

0

gem sources -a

Posted by batt | Posted in RubyOnRails | Posted on 20-02-2011

0

RubyGems will revert to legacy indexes degrading performance.
WARNING:  RubyGems 1.2+ index not found for:
gem sources -a http://gems.github.com
gem sources -a http://gems.rubyforge.org

facebook คุณเป็นพวกไหน

Posted by batt | Posted in FWD Mail, Uncategorized | Posted on 02-02-2011

0

credit :: forum ที่บอกชื่อไม่ได้

*** ถ้าเจ้าของบทความต้องการให้ลบแจ้งได้

gem install … แว๊ก ERROR

Posted by batt | Posted in RubyOnRails | Posted on 12-01-2011

0

หลังจากไม่ได้ลง windows ใหม่ปีกว่า…
พอลง ก็ต้องลงโปรแกรมนั่นนี้ และที่สำคัญ Ruby on Rails เครื่องมีทำมาหากิน

ลง ruby ตามปกติผ่านฉลุย ไม่มีอะไรเกิดขึ้น

แต่…. gem install rails(หรืออื่นๆ)

ERROR:  Error installing pg:
The ‘pg’ native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from ‘http://rubyinstaller.org/downloads’ and follow the instructions
at ‘http://github.com/oneclick/rubyinstaller/wiki/Development-Kit’

เหอๆ ยังดีที่บอกว่าให้ทำอะไรบ้าง

ก็ไปโหลด DevKit ตามที่เขาบอกที่ http://rubyinstaller.org/downloads

แล้วทำตามขั้นตอนที่ http://github.com/oneclick/rubyinstaller/wiki/Development-Kit

สรุปให้แบบง่ายๆ unzip DevKit ไว้ที่ไหนก็ได้(แต่ folder ห้ามมีช่องว่าง)
แล้วก็ไปที่ folder นั้น แล้ว run ไฟล์ dk.rb
>> ruby dk.rb init
กับ
>> ruby dk.rb install
เสร็จ

แล้วลอง gem install rails (หรืออื่นๆ) ผ่านฉลุยแน่นอน

Using a proxy with open-uri

Posted by batt | Posted in RubyOnRails | Posted on 08-01-2011

0

ทำโปรเจค EBMWiz  ตอนตั้ง server ไว้ที่ office ก็ใช้งานได้ปกตินี่นา

แต่ทำไมพอย้ายไป server ไปไว้ที่ใน มข. มันใช้ไม่ได้

สงสัยว่าอาจจะต้องใช้ proxy ก่อน

require 'open-uri'
url = 'http://www.pubmed.com/'

proxy_addr = 'http://home.kku.ac.th/proxy.pac:'
proxy_port = '3128'

page = open(url, :proxy => (proxy_addr + proxy_port))

note ไว้ก่อน ลองแล้วได้ผลยังไงจะมา update ให้ฟัง

Remove div.fieldWithErrors from Rails forms

Posted by batt | Posted in RubyOnRails | Posted on 18-12-2010

0

In a decision I have never understood, Rails forms by default add <div> ... </div> around any field in your form that has validation errors on submission. Which sucks when you end up with markup like this:

<p>
  <div><label for="post_title">Title</label></div><br />
  <div><input id="post_title" name="post[title]" size="30" type="text" value="" /></div>
</p>

At work we’ve had a hack in place for a while not that dug into ActionView and turned off this nonsense. We normally don’t go highlighting form fields with errors anyway. As it turns out though, that HTML is actually rendered by a proc you can set. By default it looks like this:

ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| "<div class=\"fieldWithErrors\">#{html_tag}</div>" }

Just override this proc to return the tag only:

ActionView::Base.field_error_proc = proc {|html, instance| html }

In your environment.rb file, that would be:

config.action_view.field_error_proc = proc {|html, instance| html }

จาก :: http://d.strelau.net/post/163547069/remove-div-fieldwitherrors-from-rails-forms

ตัวอย่างที่ทำเอง เอาไว้ที่ controller

 ActionView::Base.field_error_proc = proc {|html, instance| %{<span>#{html}<span></span></span>} }

ROR Draw image by RMagick

Posted by batt | Posted in RubyOnRails | Posted on 20-11-2010

0

require ‘RMagick’
include Magick


result = Magick::Image.new(1000, 725){ self.background_color = ‘#FFFFFF’ }
watermark = Magick::Image.read(“#{RAILS_ROOT}/public/logo/watermark.png”).first
logo = Magick::Image.read(“#{RAILS_ROOT}/public/logo/logo_xxx.png”).first
signature1 = Magick::Image.read(“#{RAILS_ROOT}/public/logo/sig1.png”).first
signature2 = Magick::Image.read(“#{RAILS_ROOT}/public/logo/sig2.png”).first
student_img = Magick::Image.read(“#{RAILS_ROOT}/public/images/gui/user_90x90.png”).first
result = result.composite(watermark, Magick::CenterGravity, 0, 0, Magick::OverCompositeOp)
result = result.composite(logo, Magick::NorthGravity, 0, 20, Magick::OverCompositeOp)
result = result.composite(signature1, Magick::NorthGravity, -250, 600, Magick::OverCompositeOp)
result = result.composite(signature2, Magick::NorthGravity, 250, 600, Magick::OverCompositeOp)
result = result.composite(student_img, Magick::NorthGravity, 345, 50, Magick::OverCompositeOp)

line1 = Draw.new
result.annotate(line1, 1000,30, 0, 200, “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”){
line1.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
line1.gravity = Magick::NorthGravity
line1.pointsize = 18
line1.fill = “#000000″
line1.font_weight = Magick::BoldWeight
}

line2 = Draw.new
result.annotate(line2, 1000,30, 0, 240, “วุฒิบัตรฉบับนี้ให้ไว้เพื่อแสดงว่า”){
line2.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
line2.gravity = Magick::NorthGravity
line2.pointsize = 18
line2.fill = “#000000″
line2.font_weight = Magick::BoldWeight
}

student_name = Draw.new
result.annotate(student_name, 1000,30, 0, 280, “#{courses_student.prefix} #{courses_student.firstname}  #{courses_student.lastname}”){
student_name.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
student_name.gravity = Magick::NorthGravity
student_name.pointsize = 18
student_name.fill = “#000000″
student_name.font_weight = Magick::BoldWeight
}

detail = Draw.new
result.annotate(detail, 1000,30, 0, 340, “ได้เข้าฝึกอบรม #{certificate_template.detail}”){
detail.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
detail.gravity = Magick::NorthGravity
detail.pointsize = 18
detail.fill = “#000000″
detail.font_weight = Magick::BoldWeight
}

if courses_student.is_certified
detail2 = Draw.new
result.annotate(detail, 1000,30, 0, 370, “และผ่านเกณฑ์การประเมินผลสัมฤทธิ์การอบรม”){
detail2.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
detail2.gravity = Magick::NorthGravity
detail2.pointsize = 18
detail2.fill = “#000000″
detail2.font_weight = Magick::BoldWeight
}
end

line3 = Draw.new
result.annotate(line3, 1000,30, 0, 4100, “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”){
line3.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
line3.gravity = Magick::NorthGravity
line3.pointsize = 18
line3.fill = “#000000″
line3.font_weight = Magick::BoldWeight
}

line4 = Draw.new
result.annotate(line4, 1000,30, 0, 440, “xxxxxxxxxxxxxxxxxxxxx”){
line4.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
line4.gravity = Magick::NorthGravity
line4.pointsize = 18
line4.fill = “#000000″
line4.font_weight = Magick::BoldWeight
}

line5 = Draw.new
result.annotate(line5, 1000,30, 0, 470, “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx “){
line5.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
line5.gravity = Magick::NorthGravity
line5.pointsize = 18
line5.fill = “#000000″
line5.font_weight = Magick::BoldWeight
}

line6 = Draw.new
result.annotate(line6, 1000,30, 0, 500, “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”){
line6.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
line6.gravity = Magick::NorthGravity
line6.pointsize = 18
line6.fill = “#000000″
line6.font_weight = Magick::BoldWeight
}

thai_mon = ["", "มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม" "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"]
date = Draw.new
result.annotate(date, 1000,30, 0, 540, “ให้ไว้ ณ วันที่ #{Date.today.day} เดือน #{thai_mon[Date.today.mon]} พ.ศ. #{Date.today.year + 543}”){
date.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
date.gravity = Magick::NorthGravity
date.pointsize = 18
date.fill = “#000000″
date.font_weight = Magick::BoldWeight
}

sig2_name = Draw.new
result.annotate(line6, 1000,30, 250, 668, “(xxxxxxxxxxxxxxxxxxxxxxxxxxxxx)”){
sig2_name.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
sig2_name.gravity = Magick::NorthGravity
sig2_name.pointsize = 18
sig2_name.fill = “#000000″
sig2_name.font_weight = Magick::BoldWeight
}

sig2_desc = Draw.new
result.annotate(line6, 1000,30, 250, 688, “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”){
sig2_desc.font = “#{RAILS_ROOT}/public/fonts/TH_Niramit_AS_Bold.ttf”
sig2_desc.gravity = Magick::NorthGravity
sig2_desc.pointsize = 18
sig2_desc.fill = “#000000″
sig2_desc.font_weight = Magick::BoldWeight
}

filename = “#{directory}/cert_#{@course.id}_#{courses_student.student_id}_#{courses_student.student_id}.jpg”
result.write(filename)