我现在正VIM从TextMate 切换到.我发现^+W在INSERT模式下非常有用.但是,我不仅要删除光标前的单词,还要删除光标后面或周围的单词.
我做了一些谷歌搜索,但我唯一能找到的是^+W删除光标之前的字.
我想从一个人的生日那里得到一个人的年龄.now - birthday / 365不起作用,因为有些年份有366天.我想出了以下代码:
now = Date.today
year = now.year - birth_date.year
if (date+year.year) > now
year = year - 1
end
Run Code Online (Sandbox Code Playgroud)
是否有更多Ruby的计算年龄的方法?
我正在为open_flash_chart插件编写自定义包装器.它被放入/lib并作为模块加载ApplicationController.
但是,我有一些类层次结构或smth问题.
从任何控制器我可以访问open_flash_chart的功能OpenFlashChart,Line等等
但是,在/lib模块中的类中,它不起作用!
有任何想法吗?
有没有工具可以检测iOS/Objective-C应用程序中的重复代码?
我有UIView一个UIController观点.我的标准是320x460视图.在applicationDidFinishLaunching我这样做:
[window addSubview:[controller view]];
Run Code Online (Sandbox Code Playgroud)
奇怪的是,它UIView位于状态栏下(就像缺少出口一样).但是,如果我将iPhone旋转到一侧然后再回来,它会显示正常.
这是一种预期的行为(我打赌我可以通过设置偏移来修复它)或者我做错了吗?
如果我尝试在Ruby文件中自动完成smth,它需要'xxx'语句,它会开始扫描所需的所有文件(以及所需文件所需的文件).它每时每刻都做到了!
是否可以使vim自动完成不扫描所需文件或仅扫描特定路径中的文件(例如app/only)?
我正在尝试将我的rails应用程序升级到Rails3.
当我运行功能测试时,我会遇到很多NameError: uninitialized constant Test::Unit::AssertionFailedError错误.但是单元测试和网站本身似乎运行良好.
跟踪看起来像这样:
NameError: uninitialized constant Test::Unit::AssertionFailedError
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library'
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/action_controller/matchers/redirect_to_matcher.rb:52:in `rescue in redirects_to_url?'
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/action_controller/matchers/redirect_to_matcher.rb:48:in `redirects_to_url?'
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/action_controller/matchers/redirect_to_matcher.rb:35:in `matches?'
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/assertions.rb:53:in `assert_accepts'
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/context.rb:324:in `block in should'
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/context.rb:382:in `call'
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
Run Code Online (Sandbox Code Playgroud)
Shoulda和Amazon S3宝石都是最新版本.
我有什么想法我做错了吗?
自从我开始使用rspec等以来,脚本/生成变得非常烦人.我不再需要单元测试文件和固定装置,但是脚本/生成无论如何都会使它们成为现实.
是否可以在系统范围内(或至少在整个项目范围内)设置--skip-fixtures和--skip-test默认?
我已经为 UITextField 层设置了一个自定义边框。当 UITextField 获得焦点时,视图会变大。但该层没有放大。因此在视图中间绘制了边框我做错了什么?