我试图运行brew update
,我得到一个错误,如果我合并,我的本地更改将丢失.我尝试了我的本地更改(不记得制作任何,但它已经有一段时间了),这让事情变得更糟.
这是输出:
MBP:Library User$ sudo brew update
error: The following untracked working tree files would be overwritten by merge:
Library/Aliases/fastcgi
Library/Aliases/htop
Library/Aliases/nodejs
Library/Aliases/ocio
Library/Aliases/oiio
Library/Aliases/pgrep
Library/Aliases/pkill
Library/Contributions/cmds/brew-beer.rb
Library/Contributions/cmds/brew-dirty.rb
Library/Contributions/cmds/brew-graph
Library/Contributions/cmds/brew-grep
Library/Contributions/cmds/brew-leaves.rb
Library/Contributions/cmds/brew-linkapps.rb
Library/Contributions/cmds/brew-man
Library/Contributions/cmds/brew-mirror-check.rb
Library/Contributions/cmds/brew-missing.rb
Library/Contributions/cmds/brew-pull.rb
Library/Contributions/cmds/brew-readall.rb
Library/Contributions/cmds/brew-server
Library/Contributions/cmds/brew-services.rb
Library/Contributions/cmds/brew-switch.rb
Library/Contributions/cmds/brew-test-bot.commit.html.erb
Library/Contributions/cmds/brew-test-bot.css
Library/Contributions/cmds/brew-test-bot.index.html.erb
Library/Contributions/cmds/brew-test-bot.rb
Library/Contributions/cmds/brew-tests.rb
Library/Contributions/cmds/brew-unpack.rb
Library/Contributions/cmds/brew-which.rb
Library/Contributions/install_homebrew.rb
Library/Formula/abcl.rb
Library/Formula/abyss.rb
Library/Formula/akka.rb
Library/Formula/apollo.rb
Library/Formula/appledoc.rb
Library/Formula/arangodb.rb
Library/Formula/autoconf.rb
Library/Formula/automake.rb
Library/Formula/avidemux.rb
Library/Formula/bind.rb
Library/Formula/bsdconv.rb
Library/Formula/bsdmake.rb
Library/Formula/camellia.rb
Library/Formula/cbmbasic.rb
Library/Formula/cdo.rb
Library/Formula/checkstyle.rb
Library/Formula/cifer.rb
Library/Formula/clhep.rb
Library/Formula/collada-dom.rb
Library/Formula/crash.rb
Library/Formula/crossroads.rb
Library/Formula/css-crush.rb
Library/Formula/curlftpfs.rb
Library/Formula/dart.rb
Library/Formula/dasm.rb
Library/Formula/dfc.rb
Library/Formula/di.rb
Library/Formula/dsniff.rb
Library/Formula/dupx.rb …
Run Code Online (Sandbox Code Playgroud) 是否有一种方便的方法来从Java String中去除任何前导或尾随空格?
就像是:
String myString = " keep this ";
String stripppedString = myString.strip();
System.out.println("no spaces:" + strippedString);
Run Code Online (Sandbox Code Playgroud)
结果:
no spaces:keep this
Run Code Online (Sandbox Code Playgroud)
myString.replace(" ","")
将取代keep和this之间的空间.
谢谢
有没有办法在StoryBoard中插入表头视图(tableHeaderView)(就像我们以前在Interface Builder中那样)?
我的代码中有以下逻辑:
if !@players.include?(p.name)
...
end
Run Code Online (Sandbox Code Playgroud)
@players
是一个数组.是否有方法可以避免!
?
理想情况下,此代码段将是:
if @players.does_not_include?(p.name)
...
end
Run Code Online (Sandbox Code Playgroud) 我编写了自己的自定义后合并钩子,现在我在我的主项目文件夹中添加了一个"hooks"目录(因为git不跟踪.git/hooks中的更改),在某处我读到我可以从钩子中创建一个符号链接到.git/hooks所以每次有人更改时我都不必将文件从一个文件夹复制到另一个文件夹,所以我尝试了:
ln -s -f hooks/post-merge .git/hooks/post-merge
但它似乎没有用,任何想法为什么?"ln hooks/post-merge .git/hooks/post-merge"工作正常,但制作一个硬链接就像copyin一样我猜....
是否有更简单的方法在命令行上为Java程序指定多个系统属性而不是多个-D语句?
试图避免这种情况:
java -jar -DNAME="myName" -DVERSION="1.0" -DLOCATION="home" program.jar
Run Code Online (Sandbox Code Playgroud)
我以为我曾经看过有人使用过一个带-D
引号的字符串的例子,但我再也找不到这个例子了.
Rails 3.2.1
有没有办法(没有吱吱声)使用ActiveRecord的哈希语法来构造!=
运算符?
就像是 Product.where(id: !params[:id])
生成 SELECT products.* FROM products WHERE id != 5
寻找相反的 Product.where(id: params[:id])
UPDATE
在轨道4中有一个not
操作员.
Product.where.not(id: params[:id])
我有以下2个型号
class Sport < ActiveRecord::Base
has_many :charts, order: "sortWeight ASC"
has_one :product, :as => :productable
accepts_nested_attributes_for :product, :allow_destroy => true
end
class Product < ActiveRecord::Base
belongs_to :category
belongs_to :productable, :polymorphic => true
end
Run Code Online (Sandbox Code Playgroud)
如果没有产品,运动就不可能存在,所以sports_controller.rb
我的拥有:
def new
@sport = Sport.new
@sport.product = Product.new
...
end
Run Code Online (Sandbox Code Playgroud)
我试图将产品的创建转移到运动模型,使用after_initialize
:
after_initialize :create_product
def create_product
self.product = Product.new
end
Run Code Online (Sandbox Code Playgroud)
我很快就知道after_initialize
只要模型被实例化(即来自一个find
调用)就会被调用.所以这不是我想要的行为.
我应该如何建模所有人sport
都有的要求product
?
谢谢
我刚刚看到一篇博客提到了j
Rails 中的一个函数.他们用它来做ajax风格的页面更新.
$('#cart').html("<%=j render @cart %>");
Run Code Online (Sandbox Code Playgroud)
我得到他们正在使用cart
局部渲染部分,但最重要的是j
什么?我发现一些文章说它将字符串转换为JavaScript会接受的内容,但这意味着什么?
有没有一种方法来创建关联.ruby-version
,并.ruby-gemset
创建一个新的宝石时的文件吗?
使用旧版本的rvm,可以做到rvm --create --rvmrc 1.8.7@project
,但这会创建.rvmrc
文件.
我以为我读过某个地方我们可以使用--ruby-version
命令行开关,但我没有成功.
git ×2
java ×2
ruby ×2
activerecord ×1
ajax ×1
command-line ×1
gemset ×1
githooks ×1
homebrew ×1
ios ×1
javascript ×1
linux ×1
model ×1
replace ×1
rvm ×1
storyboard ×1
string ×1
uitableview ×1
xcode4 ×1