之后我删除了git init rm -rf .git并启动了一个新的git init,我弄乱了我的项目?我想在我的项目中使用旧的git配置,我现在该怎么办?
我想用 Faker 为数据库做种,问题是我在执行以下操作时遇到错误:
rake db:reset
Run Code Online (Sandbox Code Playgroud)
我收到这条消息:
rake aborted!
I18n::MissingTranslationData: translation missing: en.faker.name.name
/Library/Ruby/Gems/2.0.0/gems/i18n-0.7.0/lib/i18n.rb:311:in `handle_exception'
/Library/Ruby/Gems/2.0.0/gems/i18n-0.7.0/lib/i18n.rb:161:in `translate'
/Library/Ruby/Gems/2.0.0/gems/faker-1.4.3/lib/faker.rb:128:in `rescue in translate'
/Library/Ruby/Gems/2.0.0/gems/faker-1.4.3/lib/faker.rb:120:in `translate'
/Library/Ruby/Gems/2.0.0/gems/faker-1.4.3/lib/faker.rb:86:in `fetch'
/Library/Ruby/Gems/2.0.0/gems/faker-1.4.3/lib/faker.rb:99:in `parse'
/Library/Ruby/Gems/2.0.0/gems/faker-1.4.3/lib/faker/name.rb:8:in `name'
/Users/hbendev/code/wikitec/db/seeds.rb:6:in `block in <top (required)>'
/Users/hbendev/code/wikitec/db/seeds.rb:4:in `times'
/Users/hbendev/code/wikitec/db/seeds.rb:4:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/Library/Ruby/Gems/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:547:in `load_seed'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:250:in `load_seed'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:180:in `block (2 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:139:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:setup => db:seed
Run Code Online (Sandbox Code Playgroud)
我不知道为什么会出现这个错误,因为我之前对 Faker 没有任何问题,我只是想重置数据库以更新种子。
我谷歌它,但我找不到任何相关的解决问题的方法。
我尝试添加:
I18n.reload!
Run Code Online (Sandbox Code Playgroud)
之后require …
我想同时使用getopts和位置参数,但是如果我将位置参数传递给程序,则会getopts丢失。
directory=$1
while getopts l: flag; do
case "$flag" in
l) level=$OPTARG;;
esac
done
if [ -n "$level" ]; then
echo "Level exist!"
else
echo "Level doesn't exist!"
fi
Run Code Online (Sandbox Code Playgroud)
所以当我像这样运行程序时:
sh myprogram.sh ~/documents -l 2
Run Code Online (Sandbox Code Playgroud)
我预计:
Level exist!
相反,它返回:
Level doesn't exist!
问题是,如果我在没有位置参数(~/documents)的情况下运行程序,如下所示:
sh myprogram.sh -l 2
我得到正确的输出:
Level exist!
这是为什么?如何getopts在 bash 中同时使用位置参数?
谢谢!
当我打开本地主机时,我收到此ExecJS错误消息,我不知道为什么,一些帮助会很惊人.
显示/.../conektec/app/views/layouts/application.html.erb,其中第6行引发:
SyntaxError:[stdin]:6:16:意外的换行符(在/.../conektec/app/assets/javascripts/orders.js.coffee中)
ActionView::Template::Error (SyntaxError: [stdin]:2:73: unmatched )
(in /Users/hbendev/startups/conektec/conektec/app/assets/javascripts/orders.js.coffee)):
3: <head>
4: <title>Conektec</title>
5: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6: <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7: <%= javascript_include_tag "https://js.stripe.com/v2/" %>
8: <%= csrf_meta_tags %>
9: <%= tag :meta, :name => "stripe-key", :content => ENV["STRIPE_PUBLIC_KEY"] %>
Run Code Online (Sandbox Code Playgroud)
jQuery ->
Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content'))
payment.setupForm()
payment =
setupForm: ->
$('#new_order').submit ->
$('input[type=submit]').attr('disabled', true)
Stripe.card.createToken($('#new_order'), payment.handleStripeResponse)
false
handleStripeResponse: (status, response) ->
if status == 200 …Run Code Online (Sandbox Code Playgroud) 我需要从表单中的 url 中删除“https”和“http”,以便稍后显示图像,我得到了包含标题和 url 的表单,如下所示:
形式:
<%= form_for( @article, :html => { class: "form-test", role: "form"}) do |f| %>
<%= f.label :Titulo %>
<%= f.text_field :title%>
<%= f.label :Imagen%>
<%= f.text_field :img%>
<%= f.submit "Post"%>
<% end %>
Run Code Online (Sandbox Code Playgroud)
看法:
<div class="header">
<%= image_tag("https://#{@article.img}") %>
<%= @article.title%>
</div>
Run Code Online (Sandbox Code Playgroud)
我正在寻找如何删除 https 的选项,如果您能告诉我,我将不胜感激。
我的脚本无法正常工作,我无法弄清楚bug的位置,每次我想在Python中使用该文件时,我都使用open()函数打开文件,运行时会发出错误信号:
Traceback (most recent call last):
File "my_example.py", line 26, in <module>
doc.truncate()
IOError: File not open for writing
Run Code Online (Sandbox Code Playgroud)
要运行它,我在终端中以这种方式运行它:
python my_example.py my_example_sample.txt
Run Code Online (Sandbox Code Playgroud)
这是Python脚本(代码):
from sys import argv
#from os.path import exists
script, filename = argv
print "The name of this program is %s" % script
print "The name of the file you want to read is %s" % filename
print "Press ENTER if you want to read the selected document."
print …Run Code Online (Sandbox Code Playgroud) ruby ×2
bash ×1
bloc.io ×1
coffeescript ×1
faker ×1
getopts ×1
git ×1
github ×1
javascript ×1
node.js ×1
parameters ×1
python ×1
rails-i18n ×1
shell ×1