我在使用git命令时遇到麻烦。我正在-bash: git: command not found。当我运行时$ gem list,它被报告为已安装,并且您已经在.profile下面看到了它的路径。我只是不明白为什么它不起作用。谢谢您的帮助
# MacPorts Installer addition on 2012-10-11_at_19:01:44: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH=${PATH}:/usr/local/mysql/bin
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# git path
export PATH=$PATH:/usr/local/git/bin
Run Code Online (Sandbox Code Playgroud) 您好,就像我在标题中所说的那样,我正在尝试在与 UIImage 的最大尺寸相匹配的正方形内绘制完整的 UIImage。我的问题是如何使我的代码工作。我的代码正在裁剪为正方形大小。我是 IO 新手,谁能帮忙。
PS 我需要调用 CGcontext 的哪些方法。
谢谢。
- (UIImage*)imageWithBorderFromImage:(UIImage*)source;
{
CGSize size = [source size];
CGFloat width = size.width;
CGFloat height = size.height;
CGSize resizedImageSize;
if (width < height) {
resizedImageSize = CGSizeMake(height, height);
}else {
resizedImageSize = CGSizeMake(width, width);
}
UIGraphicsBeginImageContext(resizedImageSize);
CGRect rect = CGRectMake(0, 0, resizedImageSize.width, resizedImageSize.height);
[source drawInRect:rect blendMode:kCGBlendModeNormal alpha:1.0];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(context, 1.0, 0.5, 1.0, 1.0);
CGContextStrokeRect(context, rect);
UIImage *testImg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return testImg;
}
Run Code Online (Sandbox Code Playgroud)
我正在寻找的结果类型。
我大约3个月前开始在铁轨上学习红宝石.我已经关注了关于twitter克隆的几个教程,我正在完成micheal hartl的Ruby on rails教程,我想知道如何确保推动下一个级别.我的目标是能够制作出能够达到实际网络标准的优秀应用.有很多内容可以为初学者学习rails,但我想获得博客,教程,书籍或任何其他链接,以便那些想要推动框架前进的知识.谢谢 .
我认为每个人的答案都对这个问题很重要,所以我不会验证任何答案.尊重每个人.但非常感谢并继续添加答案和反馈.
你可以帮我解决以下问题吗?我知道这是基本的,但我似乎缺少一些非常基本的东西.当我问SectionEdit.new时,事情似乎出错,虽然我指的是正确的类名.谢谢你的帮助.
这是我得到的错误.
$ edit = SectionEdit.new
NameError: undefined local variable or method `class_name' for #<Class:0x103675008>
from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/dynamic_matchers.rb:50:in `method_missing'
from /Users/seydoukonate/Sites/simple_cms/app/models/section_edit.rb:3
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:469:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:469:in `load_file'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:639:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:468:in `load_file'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:353:in `require_or_load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:502:in `load_missing_constant'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:192:in `const_missing'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:190:in `each'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:190:in `const_missing'
from (irb):14
Run Code Online (Sandbox Code Playgroud)
我已经将模型"页面"定义如下
class SectionEdit < ActiveRecord::Base
attr_accessible :admin_user_id, :section_id, :summary
belongs_to :editor, class_name => "AdminUser", :foreign_key => 'admin_user_id'
belongs_to :section
end
Run Code Online (Sandbox Code Playgroud)
管理员用户
class AdminUser < ActiveRecord::Base
attr_accessible :first_name, :last_name, :email, :username
has_and_belongs_to_many …Run Code Online (Sandbox Code Playgroud)