我一直在设置一个服务器实例(Amazon EC2,Ubuntu 12.x),并且一直试图从git克隆我自己的私有repo.
我一直在看https://help.github.com/articles/generating-ssh-keys和https://help.github.com/articles/error-permission-denied-publickey一段时间,但仍然没有好.
我在远程机器上生成了一个新的ssh密钥对
ssh-keygen -t rsa -C "myemailaddress@myemail.com"
Run Code Online (Sandbox Code Playgroud)
并设置我的git配置,我已将公钥添加到我的github帐户.电子邮件地址与我在本地计算机的ssh密钥上使用的地址相同(我不知道这是否重要).
在启动ssh-agent然后执行之后ssh-add -l,我得到的指纹结果与我的github公钥中的内容相匹配.ssh -T git@github.com还告诉我,我已成功通过身份验证.
但是,每当我尝试
git clone https://github.com/dmonopoly/myprivateproject.git
Run Code Online (Sandbox Code Playgroud)
要么
git clone git@github.com:dmonopoly/myprivateproject.git
Run Code Online (Sandbox Code Playgroud)
在远程机器上(我已经进入),我收到此错误:
fatal: could not create work tree dir 'myprivateproject'.: Permission denied
Run Code Online (Sandbox Code Playgroud)
想法?我以前处理permission denied (public key)过,但这似乎有所不同.帮助赞赏.
我最近在Heroku上设置了一个Cedar(Rails 3.1)应用程序,并运行,例如,迁移,你会做
heroku run rake db:migrate
Run Code Online (Sandbox Code Playgroud)
我了解到在任何rake命令之前使用"bundle exec"是一个好习惯(正如Katz所说http://yehudakatz.com/).所以,我想也许以下实际上是更好的做法:
heroku run bundle exec rake db:migrate
Run Code Online (Sandbox Code Playgroud)
但是为了减少冗长,是否可以使用前一个命令,或者是bundle exec批判的那个?
ruby-on-rails heroku bundler ruby-on-rails-3 ruby-on-rails-3.1
Mac似乎已经安装了Python.brew医生得出这个:
brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
Run Code Online (Sandbox Code Playgroud)
我应该删除这些配置文件,还是会导致问题?为了我:
> which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Run Code Online (Sandbox Code Playgroud)
也:
$ …Run Code Online (Sandbox Code Playgroud) 我一直坚持这个问题一段时间了.我正在尝试安装图形工具 - http://graph-tool.skewed.de/download#macos - 我有以下步骤的先决条件,图表工具网站链接到:https:// gist .github.com/openp2pdesign/8864593
而不是brew安装,这似乎没有给我所有的文件,我去了Boost的官方网站,并从那里正确下载,遵循这些步骤:http://www.boost.org/doc/libs/1_41_0/more /getting_started/unix-variants.html它主要是获取tar文件并解压缩它.
然后我把我的boost安装在这里:
/usr/local/boost_1_55_0
Run Code Online (Sandbox Code Playgroud)
我做了一个小的C++示例并确认了Boost的工作原理(使用http://www.boost.org/doc/libs/1_41_0/more/getting_started/unix-variants.html中的 "使用Boost构建简单程序").
现在问题的关键:尝试安装图形工具.在最后一步,我做到了
./configure PYTHON_EXTRA_LDFLAGS="-L/usr/local/bin"
Run Code Online (Sandbox Code Playgroud)
(PYTHON_EXTRA_LDFLAGS =" - L/usr/local/bin"只是让配置脚本找到Python好了.)
但是我得到了这个错误.(它发现Python很好,但没有提升!)
...
================
Detecting python
================
checking for a Python interpreter with version >= 2.6... python
checking for python... /Users/daze/Library/Enthought/Canopy_64bit/User/bin/python
checking for python version... 2.7
checking for python platform... darwin
checking for python script directory... ${prefix}/lib/python2.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/site-packages
checking for python2.7... (cached) /Users/daze/Library/Enthought/Canopy_64bit/User/bin/python
checking for a version of …Run Code Online (Sandbox Code Playgroud) 我在〜/ .tmux.conf中只有这两行:
unbind r
bind r source-file ~/.tmux.conf; display "Reloaded"
Run Code Online (Sandbox Code Playgroud)
我刚开始使用tmux
tmux
Run Code Online (Sandbox Code Playgroud)
和
/Users/.../.tmux.conf:2: can't establish current session
Run Code Online (Sandbox Code Playgroud)
是结果.
为什么会这样,我该如何预防呢?
我有以下内容:
has_and_belongs_to_many餐馆的用户模型,反之亦然.that has_and_belongs_to_many用餐,反之亦然.在我的ability.rb文件中,我想指定一个用户只能管理他"has_and_belongs_to"(即餐馆user.restaurants)的餐馆的饭菜.
我现在有这个:
class Ability
include CanCan::Ability
def initialize(user)
# a user can only manage meals of restaurants he has access to
can :manage, Meal do |meal|
meal.restaurant_ids & user.restaurant_ids #...this doesn't work...
end
end
end
Run Code Online (Sandbox Code Playgroud)
最好的方法是什么?
我已经咨询了https://github.com/ryanb/cancan/wiki/Defining-Abilities-with-Blocks但我仍然不知道.
这真的很烦人......它真的搞砸了我的语法高亮...我认为它突然发生在我删除了一个javascript_include_tag语句并保存后......突然突出显示改变了.
这一切都发生在我创建第一个js.erb文件的时候......
哦是的:它以前工作!!! 我已经将"erb"添加为html文件的文件关联/扩展...但由于某种原因,html.erb文件突然被解释为javascript文件!比如,在左下角,它说你正在查看什么类型的文件,当我打开html.erb文件时,它说"javascript文件"这是荒谬的...它曾经说过html erb ...
当我在网上浏览时,似乎更常使用Detector.js,但我发现还有缩小的system.min.js文件:https://github.com/mrdoob/system.js
这可能是微不足道的,但我想知道哪个是合适的,以及为什么大多数人似乎都在使用Detector(至少从我看过).他们似乎都做了这项任务.
我试图重载>运算符,所以我可以为优先级队列执行此操作:
priority_queue<Node, vector<Node>, greater<Node> > unexplored_nodes;
Run Code Online (Sandbox Code Playgroud)
我想用它作为最小堆.
这是Node结构的代码(我知道,最好有一个带有公共变量的结构,但我只想要快速和脏的东西):
struct Node {
string repr;
float d;
vector<pair<Node, float> > neighbors;
Node(string repr) {
this->repr = repr;
this->d = FLT_MAX;
}
// **All three of these forms yield errors**
// Compiles without push() call below, but yields "invalids operands to binary expression" if I do have the push() call
//bool operator()(const Node* lhs, const Node* rhs) const {
// return lhs->d > rhs->d;
//}
// Compiles without push() call below, but yields …Run Code Online (Sandbox Code Playgroud) 给定一个整数数组,整数子集的最大总和是多少,这样子集中的整数最初并不是彼此相邻的?
例子:
[3, 8, 4] => max sum is 8, since 8 > (3+4)
[12, 8, 9, 10] => max sum is 12 + 10 = 22, since this is greater than 12 + 9 and 8 + 10
Run Code Online (Sandbox Code Playgroud)
我有兴趣弄清楚这样做的算法.方法/思维过程=非常感谢.
编辑:整数范围从1到1000,包括1和1000.(因为这完全是一个学习练习,如果整数范围从-1000到1000,我仍然有兴趣学习不同的方法.)