我刚刚安装了rvm然后是bundler gem.
? ~ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.0]
? ~ gem list|grep bundler
bundler (1.0.12)
Run Code Online (Sandbox Code Playgroud)
但是当我尝试运行bundle命令时,我收到以下错误:
? ~ which bundle
bundle not found
Run Code Online (Sandbox Code Playgroud)
有趣的是,如果我在前面添加"rvm ruby",它就有效
? ~ rvm ruby bundle
Run Code Online (Sandbox Code Playgroud)
不过,我不认为我应该在任何命令之前加上rvm ruby.这种行为是否正确?
编辑:显然问题是shell之间没有记住默认配置.
如果我键入"rvm 1.8.7 --default"然后它可以工作,但是一旦我打开一个新的shell,它就不会.
我正在尝试使用mpecoid的rspec,但我遇到了这个错误:
undefined method `should_receive' for ShortenedUrl:Class
Run Code Online (Sandbox Code Playgroud)
这是我的spec_helper.rb文件:
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with …
Run Code Online (Sandbox Code Playgroud) 我正在构建一个需要运行几次的ipod touch应用程序(如闹钟).我想阻止ipod touch进入睡眠状态,除非使用手动退出应用程序.这可能与当前的SDK有关吗?
我有一个类别实体,有很多费用.我想获得给定月份中某类别的所有费用总和:
- (NSNumber *)totalForMonth:(NSDate *)date
{
...
NSPredicate *sumPredicate = [NSPredicate predicateWithFormat:@"(ANY %@ <= expenses.created_at) AND (ANY expenses.created_at <= %@)",
[date beginningOfMonth], [date endOfMonth]];
NSFetchRequest *req = [[[NSFetchRequest alloc] init] autorelease];
[req setPredicate:sumPredicate];
[req setEntity:entity];
NSError *error;
NSArray *fetchedObjects = [managedObjectContext executeFetchRequest:req error:&error];
return [fetchedObjects valueForKeyPath:@"expenses.@sum.amount"];
Run Code Online (Sandbox Code Playgroud)
}
- (NSNumber *)totalForMonth:(NSDate *)date
{
...
NSPredicate *sumPredicate = [NSPredicate predicateWithFormat:@"(ANY %@ <= expenses.created_at) AND (ANY expenses.created_at <= %@)",
[date beginningOfMonth], [date endOfMonth]];
NSFetchRequest *req = [[[NSFetchRequest alloc] init] autorelease];
[req setPredicate:sumPredicate];
[req …
Run Code Online (Sandbox Code Playgroud)
我正试图在我的可可应用程序上打开一个工作表窗口:
MyWindowController *controller = [[MyWindowController alloc] init];
NSWindow *window = [NSApp mainWindow];
[NSApp beginSheet:controller.window modalForWindow:window modalDelegate:self didEndSelector:nil contextInfo:nil];
Run Code Online (Sandbox Code Playgroud)
问题是工作表没有附加到当前窗口,而是显示在屏幕的左下角.我试过使用self.view窗口,但没有改变.我该怎么做才能让工作表位于窗口的顶部?
我试图模仿咆哮用我的应用程序做什么.在某个时刻,我想在所有其他打开的窗口上显示一个窗口,但我不想失去对活动应用程序的关注.
现在我的代码是:
[NSApp activateIgnoringOtherApps:YES];
[self makeKeyAndOrderFront:self];
Run Code Online (Sandbox Code Playgroud)
此代码将窗口置于顶部,但也使当前应用程序成为关键窗口,在这种情况下这是不希望的.
"y851sq2vh4pf".to_i(36) #4504900070017571091
Run Code Online (Sandbox Code Playgroud)
但
parseInt("y851sq2vh4pf",36) //4504900070017571300
Run Code Online (Sandbox Code Playgroud)
如何在Javascript中实现Ruby to_i(36)函数?为什么行为不同?
一些语言语法在规则中使用否定.例如,在Dart规范中使用以下规则:
~('\'|'"'|'$'|NEWLINE)
Run Code Online (Sandbox Code Playgroud)
这意味着匹配任何不是括号内的规则之一的东西.现在,我知道在flex中我可以否定字符规则(例如:[^ ab],但是我想要否定的一些规则可能比单个字符更复杂,所以我认为我不能使用字符规则.例如,我可能需要否定多行字符串的序列'"""',但我不确定在flex中这样做的方法是什么.
我认为我对内存管理缺少一些东西.这是代码:
NSString *string = @"foo";
[string release];
NSLog(@"%@", string);
Run Code Online (Sandbox Code Playgroud)
我期望使用该代码获得内存错误,但代码运行时没有错误.我注意到了这一点,因为我正在关注一本书并且在设置属性和添加子视图之前发布了scrollView(但是在插入主视图之后).
我的问题是,什么时候对象真的被解除分配?这会被认为是好的编码风格吗?
我想要获得主HD的大小.这是我正在使用的代码:
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:@"/" error:nil];
Run Code Online (Sandbox Code Playgroud)
但是这段代码并没有给我正确的HD大小.如果我的HD容量为320gb,将返回290GB.我认为还有其他卷,但我不知道如何计算它们.
我想知道的是一种获取硬盘总大小的方法.
objective-c ×5
cocoa ×4
ruby ×3
iphone ×2
core-data ×1
flex-lexer ×1
ipod-touch ×1
javascript ×1
lex ×1
mongoid ×1
negation ×1
radix ×1
rspec ×1
rsync ×1
rvm ×1