2011年12月19日 | 分类: 开源技术 | 标签: ,

开启log-bin硬盘总满,不开启log-bin表总crash,纠结啊纠结啊

没有评论 (68 views)
2011年12月6日 | 分类: 其他内容 | 标签:

image

没有评论 (71 views)
2011年11月18日 | 分类: 网站应用 | 标签: , ,

一、编辑虚拟机虚拟磁盘大小

image

阅读全文...

没有评论 (104 views)
2011年11月17日 | 分类: 开源技术 | 标签: ,

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

没有评论 (96 views)
2011年11月4日 | 分类: 编程开发 | 标签: ,
没有评论 (130 views)
2011年11月3日 | 分类: 编程开发 | 标签: , , ,
没有评论 (118 views)
2011年10月31日 | 分类: 编程开发 | 标签:

如果直接使用irb命令,在使用gem的时候会出现NoMethodError: undefined method `gem' for main:Object的错误提示

image

此时可以使用irb –r rubygems来启动,则可解决

image

或者还有一种办法,在irb启动手,手动载入rubygems

image

没有评论 (67 views)
2011年9月30日 | 分类: 互联网络 | 标签:
5 条评论 (321 views)
2011年9月15日 | 分类: 其他内容 | 标签:

一、在模板中应该有控制器名称的定义

<%= 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;
    }

  }
}

没有评论 (145 views)
2011年9月13日 | 分类: 编程开发 | 标签: , ,

<%= f.fields_for :attachments do |fields| %>
  <%= fields.file_field :uploaded_file %>
<% end %>

没有评论 (165 views)
2011年8月8日 | 分类: 开源技术 | 标签: , , ,

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.

没有评论 (224 views)
2011年8月7日 | 分类: 网络日志 | 标签: , , , ,

  Win7 NFS客户端使用mount命令挂载NFS服务之后,文件系统对Win7只读,无法写入文件,无法新建文件夹,此时使用mount命令可以查看到如下状态:

  image

  可以看到UID=-2由于在存储设备上共享出来的NFS文件系统归属于root权限,并且无法修改该所属用户,而Windows通过UID=-2的用户去写,肯定写不进去。

  解决办法就是让Win7在挂载NFS的时候将UID和GID改成0即可:打开注册表:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default,增加两项:AnonymousUid,AnonymousGid

  image

  重新启动计算机,重新mount

  image

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

2 条评论 (642 views)
Page 1 of 13612345...102030...Last »