- 浏览: 67538 次
- 性别:
- 来自: 上海
最新评论
文章列表
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 ...
- 2009-11-06 11:18
- 浏览 802
- 评论(0)
def toggle
def toggle
"subsequent times"
end
"first time"
end
#irb
>>toggle # => "first time"
>>toggle # => "subsequent times"
>>toggle # => "subsequent times"
外围的toggle方法内定义了两个操作,一是对toggle方法的不同的定义, ...
- 2009-11-06 10:50
- 浏览 816
- 评论(0)
Method parameters are considered to be variables local to that method.
Block parameters are assigned values when the block is invoked.
- 2009-11-05 20:36
- 浏览 791
- 评论(0)
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 ...
- 2009-10-28 14:32
- 浏览 1353
- 评论(0)
(原文连接: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 ...
- 2009-10-14 18:36
- 浏览 1904
- 评论(0)
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) ...
- 2009-08-11 14:07
- 浏览 1029
- 评论(0)
# 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 ...
- 2009-08-07 18:19
- 浏览 830
- 评论(0)
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 ...
- 2009-08-05 19:00
- 浏览 761
- 评论(0)
class<<self
- 博客分类:
- ruby language
问:
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 ...
- 2009-08-05 18:25
- 浏览 850
- 评论(0)
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 ...
- 2009-08-05 18:04
- 浏览 753
- 评论(0)
⌘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 ...
- 2009-07-30 16:40
- 浏览 2139
- 评论(0)
http://www.cnblogs.com/barrysgy/archive/2009/02/20/1394729.html
´ ´ © © > > µ µ ® ®
& & ° ° ¡ ¡ » »
¦ ¦ ÷ ÷ ¿ ¿ ¬ ¬ § §
• • ½ ½ ...
- 2009-07-17 10:14
- 浏览 2974
- 评论(0)
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 ...
- 2009-07-16 17:46
- 浏览 12412
- 评论(0)