环境:Mac OSX 10.10.当我尝试使用时gitk,它显示:
Coda-2:~ Coda$ gitk
-bash: gitk: command not found
Run Code Online (Sandbox Code Playgroud)
我认为原因是旧版本git.这是一些信息,我已经输入了brew update.
Coda-2:~ Coda$ git --version
git version 1.9.3 (Apple Git-50)
Coda-2:~ Coda$ brew install git
Warning: git-2.4.0 already installed, it's just not linked
Run Code Online (Sandbox Code Playgroud)
这是什么信息:it's just not linked?
此外,我检查路径git:
Coda-2:~ Coda$ which git
/usr/bin/git
Run Code Online (Sandbox Code Playgroud)
它应该在/usr/bin/local/git?怎么解决?
我明白了,谢谢@TimCastelijns.
brew doctor 说过:
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause …Run Code Online (Sandbox Code Playgroud) 我正在使用Watir抓取一些东西,但它会抛出
Unable to find Mozilla geckodriver. Please download the server from https://github.com/mozilla/geckodriver/releases and place it
Run Code Online (Sandbox Code Playgroud)
我已经完成了以下步骤.
下载最新的firefox(版本50.0)
我geckodriver从https://github.com/mozilla/geckodriver/releases下载最新版本,并将其放入~/geckodriver
然后加入export PATH=$PATH:~/geckodriver到~/.bash_profile和源它.
这是我执行的代码
require 'watir-webdriver'
browser = Watir::Browser.new :firefox # should open a new Firefox window
browser.goto 'http://nitrowriters.com/form/form.html' # or type the local path to your downloaded copy
Run Code Online (Sandbox Code Playgroud)
的Gemfile
source "https://rubygems.org"
gem 'nokogiri'
gem 'watir-webdriver'
gem 'open_uri_redirections'
gem 'selenium-webdriver'
gem "watir", ">= 6.0.0.beta2"
Run Code Online (Sandbox Code Playgroud)
环境:OSX 10.10
如何在 GoLang 中发送帖子?
我有以下代码ruby,现在我需要转入Golang。
http = Net::HTTP.new('example.com', 443)
http.use_ssl = true
http
path = '/abc/login'
data = 'data[Account][username]=myusername&data[Account][passwd]=mypassword'
resp, _ = http.post(path, data)
Run Code Online (Sandbox Code Playgroud)
这样,我可以在登录请求后获取 cookie。
但我不知道如何在 Go 中发送 post 请求。
我已经编写了以下代码。
path := "https://example.com/abc/login"
data := strings.NewReader("data[Account][username]=myusername&data[Account][passwd]=mypassword")
resp, err := http.Post(path, "text/html; charset=UTF-8", data)
Run Code Online (Sandbox Code Playgroud)
这似乎不正确,因为我没有找到获取 cookie 的方法。
我有三个型号:Book,genre,BookGenre,这里有关系:
class BookGenre < ActiveRecord::Base
belongs_to :book
belongs_to :genre
end
class Book < ActiveRecord::Base
has_many :book_genres
has_many :genres, through: :book_genres
end
class Genre < ActiveRecord::Base
has_many :book_genres
has_many :books, through: :book_genres
end
Run Code Online (Sandbox Code Playgroud)
然后我使用seedfile将数据放入这些表中.
但是,当我想再做rake db:seed一次时,它显示了这个错误
ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: update or delete on table "books" violates foreign key constraint "fk_rails_4a117802d7" on table "book_genres"
DETAIL: Key (id)=(10) is still referenced from table "book_genres".
Run Code Online (Sandbox Code Playgroud)
在我的seed.rb
Book.destroy_all
Genre.destroy_all
...create data
Run Code Online (Sandbox Code Playgroud) ruby ruby-on-rails reference foreign-keys relational-database
我需要placeholder在输入字段中放入一个长文本.
但是,placeholder由于文本很长,将会削减.
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<label for="password">
<input id="password" name="user[password]" placeholder="Password (at least 8 letters, numbers, or punctuation marks)" size="30" type="password">
</label>Run Code Online (Sandbox Code Playgroud)
升级到OS10.14后,使用时出现此错误 Httparty
response = HTTParty.get('http://api.stackexchange.com/2.2/questions?site=stackoverflow')
objc[4182]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called.
objc[4182]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
Run Code Online (Sandbox Code Playgroud)
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES在启动Rails控制台之前,我已经尝试
过了。
但这没有用。
我试图用Ruby on Rails运行Selenium的示例scirpt.我要用代理运行它.这是我的代码:
require 'rubygems'
require 'bundler/setup'
# require your gems as usual
require "selenium-webdriver"
Selenium::WebDriver::Firefox.path = "/home/marc/Documents/firefox/firefox"
profile = Selenium::WebDriver::Firefox::Profile.new
proxy = Selenium::WebDriver::Proxy.new(:http => nil)
profile.proxy = proxy
driver = Selenium::WebDriver.for :firefox, :profile => profile
driver.navigate.to "http://google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"
element.submit
puts driver.title
driver.quit
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
/home/marc/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.0.0.beta3.1/lib/selenium/webdriver/common/service.rb:115:in `connect_until_stable': unable to connect to Mozilla geckodriver 127.0.0.1:4445 (Selenium::WebDriver::Error::WebDriverError)
Run Code Online (Sandbox Code Playgroud)
有人能帮我吗...?我几个小时都在努力,找不到问题......真的不知道该怎么办.
环境:
Ubuntu 16.04 LTS,Firefox 45.0,rbenv 2.3.1
其他问题:有人知道Selenium + Ruby on Rails的一些例子吗?我找不到真正的好东西......文档很差:(
请参阅以下关联:
class Continent < ActiveRecord::Base
has_many :countrys
class Country < ActiveRecord::Base
belongs_to :continent
has_many :addresses
class Address < ActiveRecord::Base
belongs_to :person
belongs_to :street
class Person < ActiveRecord::Base
has_many :addresses
Run Code Online (Sandbox Code Playgroud)
Person.includes()在查询数据库时,如何从一直到非洲大陆开始并包含关联.
我已经能够通过国家进入.includes(addresses: :country),但似乎没有达到最后一级.
我对教程中的以下代码感到困惑。
目标是genre_id从表中删除引用键books
class RemoveGenreFromBooks < ActiveRecord::Migration
def up
remove_index :books, column: [:genre_id]
remove_column :books, :genre_id
end
def down
add_reference :books, :genre, index: true
end
end
Run Code Online (Sandbox Code Playgroud)
但我不明白什么remove_index :books, column: [:genre_id]意思
此外,我没有index: true在down方法中得到这一点。
如果我需要添加关系,为什么我不能直接输入
class Addrelationship < ActiveRecord::Migration
def change
add_reference :books, :genre
end
Run Code Online (Sandbox Code Playgroud) 我正在OS X 10.10上开发Unity 2D游戏项目,我无法拖动文件或文件夹,它会显示此错误.
No Drag&Drop has been setup. Please
UnityEditor.DockArea:OnGUI()
Run Code Online (Sandbox Code Playgroud)
我试过了:
Assets文件夹并选择Reimport All但它似乎不起作用,如何解决它?
ruby ×4
selenium ×2
activerecord ×1
css ×1
database ×1
firefox ×1
foreign-keys ×1
geckodriver ×1
git ×1
gitk ×1
go ×1
html ×1
migrate ×1
reference ×1
relationship ×1
unity5 ×1