Mac用户,请参阅: Mac用户并获得警告:Nokogiri是针对LibXML版本2.7.8构建的,但已动态加载2.7.3
我正在使用linux(openSUSE 12.3)并运行nokogiri -v显示:
WARNING: Nokogiri was built against LibXML version 2.8.0, but dynamically loaded 2.9.0
# Nokogiri (1.6.0)
---
warnings:
- Nokogiri was built against LibXML version 2.8.0, but dynamically loaded 2.9.0
nokogiri: 1.6.0
ruby:
version: 2.0.0
platform: x86_64-linux
description: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
engine: ruby
libxml:
binding: extension
source: packaged
libxml2_path: /home/william/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/ports/x86_64-suse-linux/libxml2/2.8.0
libxslt_path: /home/william/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/ports/x86_64-suse-linux/libxslt/1.1.26
compiled: 2.8.0
loaded: 2.9.0
Run Code Online (Sandbox Code Playgroud) 运用
git blame file
Run Code Online (Sandbox Code Playgroud)
将显示有关每一行的所有信息,例如谁在提交中添加此行,以及何时,但据我所知,Git将在每次更改文件时添加一个全新的对象.那么Git在哪里存储关于每一行的信息呢?
我使用一些代码在Rails 3上运行得很好但在Rails 4上运行不好,我猜它是由Turbolinks引起的,但我不太了解它,不能深入挖掘解决我的问题,这里是代码:
视图:
a/v/m/_new_comment.slim
.new-comment
- if current_user
= render "editor_toolbar"
= form_for(Comment.new, :remote => true, :url => mission_comments_path(@mission)) do |f|
= f.text_area :content, :class => "span10",
:rows => "4", :tabindex => "1"
#preview.hidden
= "Loading..."
= f.submit t("missions.submit_comment"),
"data-disable-with" => t("missions.submitting"),
:class => "btn btn-primary", :tabindex => "2"
- else
= render "need_login_to_comment"
Run Code Online (Sandbox Code Playgroud)
控制器:
def create
@mission = Mission.find(params[:mission_id])
@comment = @mission.comments.build(comment_params)
@comment.user = current_user
if @comment.save
@mission.events.create(user: current_user, action: "comment")
render layout: false
end
Run Code Online (Sandbox Code Playgroud)
和js:
<% if …Run Code Online (Sandbox Code Playgroud) 课程has_and_belongs_to的has_many标签,现在给出两个标签id,[1,2],如何查找具有这两个标签的所有课程
Course.joins(:tags).where("tags.id IN (?)" [1, 2]) 将返回具有标签之一的记录,而不是我想要的记录
# app/models/course.rb
has_and_belongs_to_many :tags
# app/models/tag.rb
has_and_belongs_to_many :courses
Run Code Online (Sandbox Code Playgroud) 我尝试在 IE 10 上使图像灰度工作,经过一些搜索使用 svg 可以将其存档,但现在我遇到了另一个问题,这是使图像灰度在 IE 10 上工作的代码
<svg xmlns="http://www.w3.org/2000/svg" id="svgroot" viewBox="0 0 400 377" width="400" height="377">
<defs>
<filter id="filtersPicture">
<feComposite result="inputTo_38" in="SourceGraphic" in2="SourceGraphic" operator="arithmetic" k1="0" k2="1" k3="0" k4="0" />
<feColorMatrix id="filter_38" type="saturate" values="0" data-filterid="38" />
</filter>
</defs>
<image filter="url("#filtersPicture")" x="0" y="0" width="400" height="377" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://thecybershadow.net/misc/stackoverflow.png" />
</svg>Run Code Online (Sandbox Code Playgroud)
问题是图像没有按我给出的大小缩放,例如,如果图像的大小是 200 X 1000 而我给出的大小是 200 X 500,它会将图像缩放到 100 X 500 之类的东西
我试过preserveAspectRatio http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute似乎不起作用
所以我的问题是如何使图像调整到我给定的大小?
提前致谢