`
sitoto
  • 浏览: 119788 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论
文章列表
手上有一个表,本来是不重复的,但是因为 field 没有明确指定为 String 还是Int,结果导致,存储的 c_num 有 123 和 "123" 这两条结果; 无奈之极,只好 将所有的 数字 变成了 字符串。 Car.where(:c_num.with_type => 16).each {|car| car.update_attribute(:c_num, car.c_num.to_s)} 再通过下面的语句删除掉重复的: db.cars.ensureIndex({c_num : 1, from_site : 1},{unique : true, dropD ...
javascript 的 escape   中文 编码成  utf-8格式的 ruby 的  unescape    中文 解析为  gbk编码的,所以ruby无法解析javascript的escape 什么情况下ruby可以解析: 还是中文的问题,在?传递中文参数时请使用encodeURIComponent. document.write(encodeURIComponent(”中文”));   =>  %E4%B8%AD%E6%96%87 document.write(escape(”中文”));                           =>  %u4E2D% ...
administrator@ubuntu:~/store$ gem install mysql2  Fetching: mysql2-0.3.13.gem (100%) Building native extensions.  This could take a while... ERROR:  Error installing mysql2: ERROR: Failed to build gem native extension.         /home/administrator/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb che ...
administrator@ubuntu:~/store$ gem source *** CURRENT SOURCES *** http://ruby.taobao.org administrator@ubuntu:~/store$ gem install nokogiri Building native extensions.  This could take a while... Successfully installed nokogiri-1.6.0 1 gem installed Installing ri documentation for nokogiri-1.6.0... I ...
//div[@xxx = "sss"]/table[2]/tr[1]/td[1]/a/@href 上面那段代码的意思说清楚,基本上可以用xpath  解析html了。 xpath() at_xpath() 做个记录先 参考资料:http://stackoverflow.com/questions/2683298/xpath-matching-attribute-and-content-of-an-element 193737895群,可交流。
看哪个目录占的空间比较大 能排序不? 闪的快呀 这 看毛啊。。。 或者只显示 统计结果吧 du -sh * | sort -hk1 如果没有h的话就两边都去掉h du -s * | sort -k1
设置FB的字集字集 utf-8 # setenv LANG zh_CN.UTF-8 PUTTY设置里 Window->Appearance : 字体选择宋体 Window->Translation  : 字符集选择  UTF-8.
apt-key是Debian软件包的安全管理工具。每个发布的deb包,都是通过密钥认证的,apt-key用来管理密钥。 1> apt-key list 列出已保存在系统中key。 Example: chao@gardenia:/etc/apt$ sudo apt-key list [sudo] password for chao: /etc/apt/trusted.gpg -------------------- pub   1024D/437D05B5 2004-09-12 uid                  Ubuntu Archive Automatic Signing Ke ...
%Q This is an alternative for double-quoted strings, when you have more quote characters in a string.Instead of putting backslashes in front of them, you can easily write: >> %Q(Joe said: "Frank said: "#{what_frank_said}"") => "Joe said: "Frank said: "Hell ...
笔者有一次需要telnet到客户的刀片光纤交换机模块上进行配置,但是当我打开windows7自带的CMD输入telnet命令之后,系统却提示我“不是内部或外部命令也不是可运行的程序或批处理”。 我的第一感觉是CMD功能失效了,于是又尝试了ping的命令,奇怪的是ping功能可以正常使用。这时候我想到了可能是在windows7上telnet这个功能没有被开启。 于是打开“控制面板”,找到程序和功能,然后点击左上方的“打开或关闭windows功能”,会弹出windows功能的对话框,这个对话框里面有许多windows的小功能,再找到Telent Client,打上勾,确认即可!
$ gem install mysql2  Building native extensions.  This could take a while...  ERROR:  Error installing mysql2:          ERROR: Failed to build gem native extension.  =============8<==ubuntu  错误解决办法========== sudo apt-get install libmysql-ruby libmysqlclient-dev  ****************=<*** ...
Known Hosts bug If you are not using agent forwarding, the first time you deploy may fail due to Capistrano not prompting with this message: # The authenticity of host 'github.com (207.97.227.239)' can't be established. # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. # Are ...
Reported by pierre.b...@gmail.com, Sep 8, 2009 What steps will reproduce the problem? 1. Nginx 6.71 2. Passenger 2.2.4 3. Random page show a 502 Gateway errors with this message [ pid=2398 file=ext/nginx/HelperServer.cpp:478 time=2009-09-08 14:49:41.259 ]:   Couldn't forward the HTTP response back t ...
Global setup: Set up git   git config --global user.name "Your Name"   git config --global user.email huang.gadela@gmail.com       Next steps:   mkdir test   cd test   git init   touch README   git add README   git commit -m 'first commit'   git remote add origin https://github.com/sitoto ...
共同点:都是用来屏幕输出的。 不同点: puts 输出内容后,会自动换行(如果内容参数为空,则仅输出一个换行符号);另外如果内容参数中有转义符,输出时将先处理转义再输出,puts传递的参数不知一个,可以有多个参数() puts 将puts("this is ge num=",a,"this is b=",b) 用逗号隔开的当做几个字符串来处理 而print 把print("this is ge num=",a,"this is b=",b)当作一个字符串来处理; print基本与puts相同,但不会处理参数中的 ...
Global site tag (gtag.js) - Google Analytics