`
clark1231
  • 浏览: 248640 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论
文章列表
Ubuntu Linux与Windows系统不同,Ubuntu Linux不会产生无用垃圾文件,但是在升级缓存中,Ubuntu Linux不会自动删除这些文件,今天就来说说这些垃圾文件清理方法。 1,非常有用的清理命令: sudo apt-get autocleansudo apt-get cleansudo apt-get autoremove   这三个命令主要清理升级缓存以及无用包的。 2,清理opera firefox的缓存文件: ls ~/.opera/cache4 ls ~/.mozilla/firefox/*.default/Cache 3,清理Lin ...
ubuntu下apt-get 命令参数   常用的APT命令参数   apt-cache search package 搜索包   apt-cache show package 获取包的相关信息,如说明、大小、版本等   sudo apt-get install package 安装包   sudo apt-get install package - - reinstall 重新安装包   sudo apt-get -f install 修复安装"-f = ――fix-missing"   sudo apt-get remove package 删除包 ...
1.sudo apt-get install pidgin 2.sudo add-apt-repository ppa:lainme/libqq  3.sudo apt-get update 4.sudo apt-get install libqq-pidgin
一、循环结构1.    for…in语句:Ruby提供的for...in语句主要用于迭代数组和Hash对象中的元素,与其它语言的for语句有一定的差距,语法格式: for val  in  Array | Hash | Range [do]               #code end ----------------------------------------------------迭代数组:

带序号循环Hash

    博客分类:
  • ruby
hash.keys.each_with_index do |key, index| value = hash[key] print "key: #{key}, value: #{value}, index: #{index}\n" # use key, value and index as desired end  
1.创建项目 rails new blog     2.创建数据库 cd blog rails g scaffold Post title:string user:string content:text rails g scaffold Comment body:text user:string post:references rake db:migrate    3.指定主页 config/routes.rb中增加 root :to => 'posts#index' 删除
sudo rm /usr/share/python-support/ailurus.public -f sudo mkdir /usr/share/python-support/ailurus.public sudo dpkg --remove --force-remove-reinstreq ailurus  
1.安装 sudo add-apt-repository ppa:webupd8team/sublime-text-2 sudo apt-get update sudo apt-get install sublime-text-2   2.汉字显示 菜单栏 -> Preferences -> File Settings - User,在配置文件中增加:   "font_face": "WenQuanYi Micro Hei Mono" 3.更新 sudo apt-get install sublime-text-2 4. ...
  .nil? can be used on any object and is true if the object is nil .empty? can be used on strings, arrays and hashes and returns true if: String length == 0 Array length == 0 Hash length == 0
  1.rails new demo 2.cd demo 3.rails generate controller Say hello goodbye 生成一个控制器say和两个页面hello与goodbye 4. rails server 5.Rails g scaffold Product title:string description:text 创建数据库中的表结构 表名: Product 字段名:title、description 字段属性:string、text

git的使用

    博客分类:
  • git
git 
Git的一般使用流程 1. git status 获取状态,看当前工程时候被修改过 2.当存在文件的修改而没有新的文件加入时 git commit -am "xxxx" 3.当存在有新建的文件时,应该先将新文件加入到“仓库”中,再commit (1)git add . (2)git commit -am "xxx" 4.git pull 从服务器中取到最新的代码,将其与自己的代码合并,若merge(合并)出现conflict(冲突)时,找到产生冲突的文件,将其修改无误后再次 git status ----------(重新确认一遍) ...

ruby case表达式

    博客分类:
  • ruby
  Ruby 中的 case 语句非常强大,首先我们来看一个基本用法: grade = case when point >= 85: 'A' when point >= 70 && point < 80: 'B' when point >= 60 && point < 70: 'C' when point < 60: 'D' else 'E' end  这里 ...
Block 不是对象,是Ruby的语言特性,近似于闭包(Closure)。 范例: def meth   res=  yield  "Block called returns #{res}"endputs  meth do next “next_value” end    #Block called returns next_value puts  meth do break “break_value” end   # break_vcowcuo错误哦alue def my   meth do return “reutnr_value” end
使用Ruby 1.9.2,Rails 3.0.6版运行 $ rake db:migrate 时报错 rake aborted! uninitialized constant Rake::DSL /usr/lib/ruby/1.9.1/rake.rb:2482:in `const_missing' /usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/tasklib.rb:8:in `<class:TaskLib>' ....... /usr/lib/ruby/1.9.1/rake.rb:2006:in `load_ra ...
在第二次页面跳转前加入flash.keep将信息保留住 Keeps either the entire current flash or a specific flash entry available for the next action: flash.keep # keeps the entire flash flash.keep(:notice) # keeps only the "notice" entry, the rest of the flash is discarded
Global site tag (gtag.js) - Google Analytics