`
lfx_cool
  • 浏览: 67790 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
java的io流真的有点繁琐,对于向我这种不常搞java的人来说,几下这些function的用法有点难度, 在这里拷几行代码备用. 从inputstream里读取string的简单方法: BufferedReader r = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder total = new StringBuilder(); String line; while ((line = r.readLine()) != null) {     total.append(line); }
http://code.google.com/p/android-apktool/ 能解压rar或zip格式的程序都能原来解压apk文件, 但是解压后的java代码和xml文件都是加码的, 没法看懂的, 解压dex文件有点复杂, 但解码xml相对容易, 打开cmd或terminal, 输入 "apktool d appname.apk", 即可得到解压成功, 当然前提系统要能够找的到apktool, 请先下载apktool文件并将路径添加到path环境变量下. google一下很容易找到两个反编译dex工具, Dedexer, Smali/Baksmali. apkto ...
A return from inside a block that’s still in scope acts as a return from that scope. A return from a block whose original context is not longer valid raises an exception (LocalJumpError or ThreadError depending on the context). The following example illustrates the first case: 引用def meth1   (1..10 ...
def toggle def toggle "subsequent times" end "first time" end #irb >>toggle # => "first time" >>toggle # => "subsequent times" >>toggle # => "subsequent times" 外围的toggle方法内定义了两个操作,一是对toggle方法的不同的定义, ...
  Method parameters are considered to be variables local to that method.   Block parameters are assigned values when the block is invoked.
git status #查看状态 git diff #查看修改的内容 git add|rm [path] #将修改添加到一个commit git add . #快速添加全部修改,不必单个文件逐一添加 git commit #提交到本地库 git reset [HEAD] git reset HEAD^ git revert HEAD git pull #将远程库中的更新更新到本地 git rebase --continue #发生冲突时,修改冲突后使用 git push #提交到远程库 其他常用命令: git show [commit version] #显示某一次commit ...
(原文连接:http://jjinux.blogspot.com/2009/07/rails-rspec-cucumber-authlogic-and.html) Friday, July 17, 2009 Rails: RSpec, Cucumber, Authlogic, and factory_girl After a day of work and a week of reading The RSpec Book, I got RSpec, Cucumber, Authlogic, and factory_girl to play nicely with each other. I c ...
we specified the arguments as *args, meaning “collect the actual parameters passed to the method into an array named args.” 比如: def some_method(arg1, arg2, *args)   ... end 调用some_method(1,2,3,4,5)相当于some_method(1,2,[3,4,5]) 例1: class File   def self.open_and_process(*args)   f = File.open(*args) ...
# db/migrate/6_add_foreign_key.rb class AddForeignKey < ActiveRecord::Migration def self.up execute "ALTER TABLE bees ADD CONSTRAINT beehive_id_fkey FOREIGN KEY (beehive_id) REFERENCES beehives (id);" end def self.down execute "ALTER TABLE bees DROP CONSTRAIN ...
The "include" statement is for including a module into a class:    1. module Bar    2. end    3.     4. class Foo    5.   include Bar    6. end The "require" statement loads a ruby file. Just loading a file does not include it into a class, so that's why you need include as we ...

class<<self

问: Hi    I have code like    class A      class <<self         def first          -------         end         def second           ------          end       end     end     What I understood is now the def first and second becomes class methods of class A..Am I right? Is that its only use? T ...
Correct Understand: "extend" adds methods from a module into a class as class methods. "include" adds methods from a module into a class as instance methods. It is quite easy to demonstrate this actually. module SomeModule   def hi     puts "hello"   end end class E ...
⌘T: Go To File,这个每天要用到N次 Esc: 自动补全 ⌃W: 选中当前word 还有默认的类似Emacs的光标移动,不过这些是Mac自己的快捷键 For Rails: ⌘R: Run ⌃|: ... ⌥⌘⇧↓ : Go to... ⌃⇧H:生成partial template ctrl + ⌘ +上下键:移动整行 ctrl + shift + K: 删除整行 ctrl + shift +D:复制整行 =============================================== 这个是我的读书笔记,同时也是使用最多的快捷键。 最有用的可能是command+T ...
http://www.cnblogs.com/barrysgy/archive/2009/02/20/1394729.html ´ &acute; © &copy; > &gt; µ &micro; ® &reg; & &amp; ° &deg; ¡ &iexcl;   &nbsp; » &raquo; ¦ &brvbar; ÷ &divide; ¿ &iquest; ¬ &not; § &sect; • &bull; ½ &frac12 ...
HTML: button和input button的区别 一句话概括主题:<button>具有<input type="button" ... >相同的作用但是在可操控性方面更加强大。 HTML 4.01规范的Forms部分指 名表单有以下几种控制类型:buttons, checkboxes, radio buttons, menus, text input, file select, hidden controls, object controls. 其中除了buttons/menus/object controls之外,都是由<input ...
Global site tag (gtag.js) - Google Analytics