`
文章列表
在ruby中输入 puts (10.12 * 100).to_i  结果将会是1011,是不是有点不可思议 如何解决这个问题呢? require 'bigdecimal' puts (BigDecimal.new(10.12.to_s) * 100).to_i   转化成BigDecimal类型再处理,这样就没有问题了。 
使用 ckeditor 插件遇到此问题,解决办法   找到 utils.rb   将       unless RUBY_PLATFORM =~ /mswin32/ 替换成       unless RUBY_PLATFORM.downcase =~ /mswin|mingw/
修改 c:\ruby\lib\ruby\gems\1.8\gems\watir-1.6.5\lib\watir\win32ole.rb 文件中的下面代码WIN32OLE.codepage = WIN32OLE::CP_UTF8修改为WIN32OLE.codepage =  WIN32OLE::CP_ACP    
vi / etc/ logrotate.d/ nginx /var/log/nginx/*.log { daily missingok compress rotate 30 dateext notifempty sharedscripts extension gz postrotate [! -f /var/log/nginx/nginx.pid ] || kill -USR1 `cat /var/log/nginx/nginx.pid` endscript }   / etc/ ...
opt分区分了8G空间的,下面放置的文件总量是 800m,但是用 df -k 查看的时候却发现/opt分区已经使用了95%,很奇怪。   于是 lsof -n | grep  delete   发现几个删除进程,kill 掉他们,空间恢复。
最近发现使用google api一直出现403错误,这是个认证错误。在网上查一下,发现是google api做了一些调整,增加了一些认证相关的参数      curl -d accountType=GOOGLE  -d Email=xxx@gmail.com  -d Passwd=xxx  -d service=reader https://www.google.com/accounts/ClientLogin SID=<SID value> # ignored LSID=<LSID value> # ignored Auth=<auth value&g ...
Enabling url parameter based sessions in Ruby on Rails Posted by Paul McMahon on 2010年4月9日 Out of the box, Ruby on Rails uses cookies to store a user's session ID. This is fine for most applications, but doesn't work if your application needs to support bro ...
  yum install sqlite-devel   gem install sqlite3-ruby -v 1.2.5
wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg chmod +x apt-cyg mv apt-cyg /usr/local/bin/ After that you'll be able to install say the package "lynx" including dependencies by running: apt-cyg install lynx
在项目用了memcached存储session,还用了 extended_fragment_cache 做页面内的缓存,缓存没有问题,可是却发现缓存总是也过不了期,深入查看rails代码才发现,原来是网上找的文档都已经过期了。   现在正确的用法是   设置session过期 ActionController::Base.session_options[:expire_after] = 1.seconds   使用 extended_fragment_cache做页面缓存 <% Cache "my_page", {:expires_in=> 1 ...
将 -draw 'text 5,21 "ABCDEF"' 改成  -draw "text 5,21 'ABCDEF'"   其他类似 Non-conforming drawing primitive definition `line' 也同样解决办法    
 t.column :code, "char(2)", :null => false
Rails Modularity for Lazy Bastards 2009-04-16 04:31, written by Gregory Brown When we develop standalone systems or work on libraries and frameworks, modularity seems to come naturally. When something seems to gain a life of its own, we pull it off into its own package or subsystem to kee ...
#config.time_zone = 'UTC' config.active_record.default_timezone = :local config.active_record.time_zone_aware_attributes = false config.time_zone = nil  
class String require 'iconv' def gbk_to_utf8 Iconv.conv("UTF-8", "gbk", self) rescue self end def utf8_to_gbk Iconv.conv("gbk", "UTF-8", self) rescue self end end module Backend module Mssql module InstanceMethods ...
Global site tag (gtag.js) - Google Analytics