Get it from the App Store.
In XCode's Preferences > Downloads you can install command line tools.
2 ways to extract elements from within XML namespaces using Nokogiri | |
When trying to select elemenets in the default namespace, e.g. "xmlns= http://www.w3.org/2005/Atom", try the following two ways. Note the xmlns=" attribute on entry element: | |
Original xml: | |
Nokogiri::XML(@xml_string).xpath("//author/name").each do |node| | |
puts node | |
end | |
1. Define a namespace context for your XPath expression and point your XPath steps to match elements in that namespace. Define a namespace-to-prefix mapping and use this prefix (a) in the XPath expression. |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
#encoding: utf-8 | |
class ContatoMailer < ActionMailer::Base | |
def receive(message) | |
p message | |
end | |
end |
原文 Assembler / なぜx86ではMBRが"0x7C00"にロードされるのか?(完全版)
感謝 descent 大大分享本文,隨便看隨便譯。本文不是逐句譯,同時也不是這方面的專家 (不管是語言或技術),用語不一或缺漏錯誤在所難免,歡迎自行 fork 修正指教
誰適合看本文?
對 x86 架構與組合語言有基礎認識,以及從 MBR 到載入 OS 這一段過程有興趣的人 (還有談到中斷向量或 INT xxx 時不會一臉茫然的人)
I use the latest Puma v1.4.0 from rubygems.
Make sure you have nginx installed with these options:
>/opt/nginx/sbin/nginx -V
nginx version: nginx/1.0.15
built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
# config/initializers/redcarpet.rb | |
module ActionView | |
module Template::Handlers | |
class Markdown | |
class_attribute :default_format | |
self.default_format = Mime::HTML | |
def call(template) | |
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true) | |
markdown.render(template.source).html_safe.inspect |
function toWareki(year,month,day) | |
{ | |
var wareki = ""; | |
year = Number (year); | |
if (year == 1868) | |
{ | |
/* 9月8日から明治元年 */ | |
/* 誕生日がここの人はいないだろうから細かくは気にしない */ | |
wareki = '明治元年'; | |
} |
# SSL self signed localhost for rails start to finish, no red warnings. | |
# 1) Create your private key (any password will do, we remove it below) | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |