开启log-bin硬盘总满,不开启log-bin表总crash,纠结啊纠结啊
echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce
net.ipv4.conf.eth0.arp_ignore = 1
net.ipv4.conf.eth0.arp_announce = 2
如果直接使用irb命令,在使用gem的时候会出现NoMethodError: undefined method `gem' for main:Object的错误提示
此时可以使用irb –r rubygems来启动,则可解决
或者还有一种办法,在irb启动手,手动载入rubygems
一、在模板中应该有控制器名称的定义
<%= content_tag :body, :class => "#{controller.controller_name}" do %>
<% end %>
二、在CSS中应该有针对控制器的过滤
.topics {
.topic {border-bottom: 1px #CCC solid;
padding: 4px 0px;.title {
font-size: 14px;
}
.attachments_count {
color: #999;
}
.comments_count {
color: #999;
}
.updated_at {
color: #999;
}}
}
<%= f.fields_for :attachments do |fields| %>
<%= fields.file_field :uploaded_file %>
<% end %>
David added a very cool feature to Rails recently – Signed cookies and permanent cookies This lets you set permanent and/or signed cookies very easily.
Before this, you’d have to write :
cookies[:user_preference] = {
:value => @current_user.preferences,
:expires => 20.years.from_now.utc
}
Now just becomes :
cookies.permanent[:user_preference] = @current_user.preferences
In case you happen to have seen my Railssummit presentation I had talked about using ActiveSupport::MessageVerifier for implementing “Remember me” functionality. The above commit makes that a whole lot easier.
In your model User.rb :
# User.rb def self.authenticated_with_token(id, stored_salt) u = find_by_id(user_id) u && u.salt == stored_salt ? u : nil end
And when the user checks “Remember me” box, make sure the following gets run :
cookies.permanent.signed[:remember_me] = [current_user.id, current_user.salt]
This will set a permanent and signed cookie using the secret specified in ActionController::Base.cookie_verifier_secret. If you don’t have the cookie_verifier_secret defined, you might want to do that in one of the initializers.
Now when you want to login using the cookie :
user = User.authenticated_with_token(*cookies.signed[:remember_me])
In this specific case, it’s very important to use the salt in the cookie value. That makes sure the cookie gets invalidated if the user changes his password.
Win7 NFS客户端使用mount命令挂载NFS服务之后,文件系统对Win7只读,无法写入文件,无法新建文件夹,此时使用mount命令可以查看到如下状态:

可以看到UID=-2由于在存储设备上共享出来的NFS文件系统归属于root权限,并且无法修改该所属用户,而Windows通过UID=-2的用户去写,肯定写不进去。
解决办法就是让Win7在挂载NFS的时候将UID和GID改成0即可:打开注册表:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default,增加两项:AnonymousUid,AnonymousGid

重新启动计算机,重新mount

然后就可以正常写入文件了

