• 关于昨天 Live Show 的视频 at 2013年03月07日

    看你们最后那项目里的,controller 里都是 js 文件,这是什么来的?第一次见过,有没有相关文章推荐一下。

  • #1 楼 @lgn21st

    bogon:~ feng$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
    WARNING: The host 'bogon' could not be looked up with /usr/local/opt/mysql/bin/resolveip.
    This probably means that your libc libraries are not 100 % compatible
    with this binary MySQL version. The MySQL daemon, mysqld, should work
    normally with the exception that host name resolving will not work.
    This means that you should use IP addresses instead of hostnames
    when specifying MySQL privileges !
    
    FATAL ERROR: The parent directory for the data directory '/usr/local/var/mysql' does not exist.
    If that path was really intended, please create that directory path and then
    restart this script.
    If some other path was intended, please use the correct path when restarting this script.
    

    请问这个是什么情况呢?

  • #34 楼 @outman 亲测,你这个方法是简单又可行的。

  • Moutain Lion 下安装 Ruby 1.9.3 at 2013年03月04日

    #5 楼 @luikore

    rvm requirements
    
    # For update-system:
    Always update your system first!
    
    # For rvm:
    Install: bash curl git patch
    
    # For ruby:
    Install: osx-gcc-installer libksba openssl libreadline git zlib1g libyaml libsqlite3 sqlite3 libxml2 libxslt autoconf libc6 libgdbm ncurses automake libtool bison pkg-config
    
    # For jruby:
    Install: openjdk ant
    

    请问象这些 install 应该怎么执行命令去安装呢?

  • 付款成功。😄

  • #1 楼 @jimrokliu #7 楼 @xiaolai #32 楼 @blacktulip 我也是喜欢 air,觉得笔记本还是要以轻便为主。但是现在 rmbp 掉价了,觉得好吸引,我想问问 retina 有和没有真的差别大吗?目前没有使用过 retina。

    11寸MacBook Air 2.0GHz 雙核心 Intel Core i7.8GB 記憶體.256GB 快閃儲存
    13寸MacBook Pro 2.5GHz 雙核心 Intel i5 配備 Retina 顯示器.8GB .128GB 快閃儲存
    

    这部知道选哪个好。

  • #1 楼 @happypeter #2 楼 @hellpeng #3 楼 @badboy #4 楼 @kgen #5 楼 @chairy11 奈吉尔马什的观点不错,健康的生活方式确实很重要。 无意中和朋友谈起人生的追求时,突然有的感慨,所以写下来。 因为我身边有个亲戚,有豪车有豪宅,在别人眼中已经是羡慕的对象。但是他自身却不满足,他非常羡慕那些有比他更好车子的人。人啊,真可怕。

  • 新手做网站 at 2013年02月05日

    routes 和 model 没有必然的联系。 routes 只是生成的 url 地址:如果你 2 层嵌套,url 地址就是:year/:year_id/months/ 如果可以的话,就不要用那么多层嵌套,可以看看这两个: http://ihower.tw/rails3/activerecord-relationships.html http://ihower.tw/rails3/restful-practices.html

  • datatables 如何做做 I18n ? at 2013年02月05日
    "oLanguage": {
      "sProcessing": "正在加载中......",
      "sLengthMenu": "每页显示: _MENU_ 条记录",
      "sZeroRecords": "抱歉, 没有找到",
      "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
      "sInfoEmpty": "没有数据",
      "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
      "sSearch": "搜索:",
      "oPaginate": {
        "sPrevious": "前一页",
        "sNext": "后一页"
      },
      "sZeroRecords": "没有检索到数据"
    },
    

    http://www.datatables.net/release-datatables/examples/advanced_init/language_file.html

  • crazy.

  • 永远不要使用动态的查找方法。例如:find_by_... 我想了解一下这个,不用是避免注入吗? 使用where代替?

  • 笑来老师,我想问问,那个 UP 的 APP 要到美国的 APP STORE 才可以下载,请问怎么登陆美国 APP STORE 的?需要收费的吗?

  • MySQL 下需要设置一下:scale => 2,默认 MySQL 是:scale => 0.

    change_column :XXX, :price, :decimal, :scale => 2
    
  • rails 怎么重置主键,不知道。MySQL 里的语句是: truncate table tb_name;

  • #13 楼 @small_fish__ http://ruby-china.org/topics/1768 看看这贴的方法可以解决你的问题不?

  • 好想有个师傅 at 2013年01月17日

    苍老师一直是我的老师。。。-_-||

  • 好像问题比较严重,才升了 10 没几天,又升 11 了。。。

  • #5 楼 @pzgz 分页断页好像这个 CSS 可以做:

    page-break-before: always;
    

    CSS 打印属性(Print)

    • orphans:设置当元素内部发生分页时必须在页面底部保留的最少行数。
    • page-break-after:设置元素后的分页行为。参考:page-break-after
    • page-break-before:设置元素前的分页行为。参考:page-break-before
    • page-break-inside:设置元素内部的分页行为。参考:page-break-inside

    #4 楼 @QueXuQ 页脚页眉可以通过下面方法做:

    --footer-center*    <text>  Centered footer text
    --footer-font-name* <name>  Set footer font name (default Arial)
    --footer-font-size* <size>  Set footer font size (default 11)
    --footer-html*  <url>   Adds a html footer
    --footer-left*  <text>  Left aligned footer text
    --footer-line*      Display line above the footer
    --footer-right* <text>  Right aligned footer text
    --footer-spacing*   <real>  Spacing between footer and content in mm (default 0)
    --header-center*    <text>  Centered header text
    --header-font-name* <name>  Set header font name (default Arial)
    --header-font-size* <size>  Set header font size (default 11)
    --header-html*  <url>   Adds a html header
    --header-left*  <text>  Left aligned header text
    --header-line*      Display line below the header
    --header-right* <text>  Right aligned header text
    --header-spacing*   <real>  Spacing between header and content in mm (default 0)
    

    简单来说,就是在下面的文件下加东西就可以了:

    # config/initializers/pdfkit.rb
    PDFKit.configure do |config|
      # config.wkhtmltopdf = '/path/to/wkhtmltopdf'
      config.default_options = {
        :page_size => 'Legal',
        :print_media_type => true,
        :header_left => "XXX"   #在页眉顶端左边加入XXX
      }
      # config.root_url = "http://localhost" # Use only if your external hostname is unavailable on the server.
    end
    

    详情参考:wkhtmltopdf-0.9.9-doc

  • Rails 3.2.3 CSS JS 加载问题 at 2012年12月06日

    #9 楼 @lamp 就是默认下 rails 只都去 application 这个名字的 js 和 css 的,就算你直接用<%= stylesheet_link_tag "scaffold" %>在开发模式下可行,生产模式下也是不可行的。因为用生产模式的时候,他会把所有的 js 或者 css 文件压缩到 application 这个 js 和 css 文件里,原因是 application 里面有一句:

    //= require_tree .  //js
     *= require_tree .  //css
    

    所以你如果想要引入别的名字需要我在上面说的那样config/environments/production.rb修改里面的东西。 如果你在里面添加了 scaffold.js,那他压缩的时候会把这个 js 文件也一同压缩,其实也就是在压缩的同时会把文件复制到 public 目录下。 压缩命令:

    rake asserts:precompile
    
  • Rails 3.2.3 CSS JS 加载问题 at 2012年12月05日

    你看的那个书的版本是不是中文版的?如果是的话,书里的内容已经是 rails3.0.x 版本的,太旧了。 3.1 以后的版本引入了一个叫 Asset Pipeline 的概念,解释见下文: http://guides.rubyonrails.org/asset_pipeline.html 默认加载的 js 和 css 文件是:

    <%= stylesheet_link_tag "application" %>
    <%= javascript_include_tag "application" %>
    

    如果需要改文件名的名字需要到config/environments/production.rb修改,改成如下:

    config.assets.precompile += ['defaults.js', 'depot.css']
    

    看我上面的那个链接,讲的很清楚的了。如果还不懂,建议看最新版的"Agile_Web_Development_with_Rails_4th_for_Rails_3.2".

  • 哈哈。不是学校要提升就业率一定要你签三方协议的吗?

  • 七牛好还是 dropbox 好? frayay#gmail.com

  • 请问 setup 是哪里呢?

  • 我一直觉得这种通过别的社区帐号进入的方式很麻烦,除非功能足够的简洁。 例如我之前在京东一直通过 QQ 登陆,紧接着的麻烦就来了,什么使用什么卷的,需要什么帐号密码的,我根本连我自己的帐号密码是什么都不知道,如何使用优惠卷? 结果整了老半天才整好。

  • 求教一个 slim 写 js 的问题 at 2012年11月05日

    #11 楼 @morecho

    javascript:
      js代码
    
  • 关于 transaction 事物问题 at 2012年11月05日
  • 我作为一个淘宝皇冠卖家来说,你这个问题就像是: 为什么 APP 为什么要放到 itunes 里卖,而不自己另外弄个站点?(假设 iphone 可以通过别的地方安装 APP) 为什么我要开个 NIKE 专卖店,而不自己搞个牌子来卖?

  • @hooopo 这个真心不错哦! 如果有 2 级菜单呢?

  • @williamherry

    *** [err :: depot.linuxcbt.com] find: `/home/william/depot.linuxcbt.com/releases/20121104135345/public/images'
    *** [err :: depot.linuxcbt.com] : No such file or directory
    *** [err :: depot.linuxcbt.com] find: `/home/william/depot.linuxcbt.com/releases/20121104135345/public/stylesheets': No such file or directory
    *** [err :: depot.linuxcbt.com] find: `/home/william/depot.linuxcbt.com/releases/20121104135345/public/javascripts': No such file or directory
        command finished in 14ms
    

    在这里报错的,不知道为什么会提示你没有/images,/stylesheets,/javascripts 这 3 个文件夹。 http://stackoverflow.com/questions/3023857/capistrano-and-deployment-of-a-website-from-github 这里有解决方法,不太理解为什么你那会出现这个问题呢?

  • Topics.where(:user_id => user_id).group("topics(user_id)").order("user_id DESC")
    

    不知道是不是我上面的写法,不过我估计是错的。^_^ 可以参考这里:http://guides.rubyonrails.org/active_record_querying.html