项目摘抄

本文深入探讨了编程领域中多个关键技术点,包括数据结构、算法、数据库理论等核心内容。从数据结构的角度阐述了二叉树、队列、栈等基本概念;在算法部分,详细介绍了排序算法、动态规划、哈希算法等高级技巧;同时,还深入剖析了数据库理论中的数据模型、索引理论、事务管理等关键原理。本文旨在为程序员提供全面的技术知识框架,帮助他们更好地理解和应用这些核心概念。
belongs_to :user, :inverse_of => :topics

  counter_cache :name => :user, :inverse_of => :topics



受保护属性,不能接受页面参数

 attr_protected :user_id

 scope :last_actived, desc("replied_at").desc("created_at")



controller:

 caches_page :feed, :node_feed, :expires_in => 1.hours




国际化:

初始化:

I18n.default_locale = :en


LANGUAGES = [
  ['English',                  'en'],
  ["Español".html_safe, 'es']
]  


气质过滤器:

 def set_i18n_locale_from_params
      if params[:locale]
        if I18n.available_locales.include?(params[:locale].to_sym)
          I18n.locale = params[:locale]
        else
          flash.now[:notice] = 
            "#{params[:locale]} translation not available"
          logger.error flash.now[:notice]
        end
      end



自增:(计数器)

 @topic.hits.incr(1)

counter :hits, :default => 0



防止crsf攻击:

protect_from_forgery    ----controller

  <%= csrf_meta_tag %>   --layout


发起其他方式提交:标签用

auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {})


分词插件:RMMSeg::Algorithm


input=text 默认显示字体  设置 :placeholder =>"xianshi"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值