我有一个git分支调用9-sign-in-out完美的代码,我想把它变成主.我现在在主分公司.
$ git branch
9-sign-in-out
* master
Run Code Online (Sandbox Code Playgroud)
我正在尝试切换到9-sign-in-out分支,但它不允许我:
$ git checkout 9-sign-in-out
app/helpers/application_helper.rb: needs merge
config/routes.rb: needs merge
error: you need to resolve your current index first
Run Code Online (Sandbox Code Playgroud)
任何想法如何忽略所有主分支错误并将9-sign-in-out分支转换为主分支?也许是git rebase?但我不想丢失9-sign-in-out分支中的代码.
我正在尝试使用相同的代码和相同的git存储库创建2个不同的Heroku应用程序.App1是由我的朋友在Heroku中创建的,我不是协作者,app2是我正在尝试部署的同一个git存储库的分支.这可能吗?
当我尝试将第二个应用程序部署到Heroku时,我收到错误:
$ git push heroku branch1:master
! my_email_id@gmail.com not authorized to access app1
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud) 我正在尝试将压缩图像复制到 Beaglebone 内的分区中。通常,这是一个两步过程:
xz -d console.img.xz # console.img is created
dd if=console.img of=/dev/mmcblk0p3
Run Code Online (Sandbox Code Playgroud)
有没有办法,我可以在不解压缩文件的情况下一步完成*.img.xz?这是因为解压后的镜像对于当前分区来说太大了。
如何修改路由http://localhost:3000/profiles/1到http://localhost:3000/myusername?
我有一个配置文件模型与下表:
def self.up
create_table :profiles do |t|
t.string :username
t.text :interest
t.timestamps
end
end
Run Code Online (Sandbox Code Playgroud)
我的routes.rb档案:
resources :profiles
Run Code Online (Sandbox Code Playgroud)
我已经看过类似的答案处理to_param,设计或嵌套循环甚至Rails 2.3中的一个例子,但我找不到一种有效的方法.
我应该做什么改变profile/view/show.html.erb,routes.rb以及model/profile.rb(如果有的话)修改路由http://localhost:3000/profiles/1到http://localhost:3000/username?我正在学习基础知识,因此我宁愿不使用任何宝石或插件.
我正在使用带有谷歌自定义字体的svg,但我自己托管它.这是包含以下代码的SVG文件:
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="430" height="590">
<defs>
<style type="text/css"><![CDATA[
@font-face {
font-family: 'Fjalla';
src: url('http://build-podcast.com/fonts/fjalla.eot');
src: url('http://build-podcast.com/fonts/fjalla.eot?#iefix') format('embedded-opentype'),
url('http://build-podcast.com/fonts/fjalla.woff') format('woff'),
url('http://build-podcast.com/fonts/fjalla.ttf') format('truetype'),
url('http://build-podcast.com/fonts/fjalla.svg#fjalla') format('svg');
font-weight: normal;
font-style: normal;
}
text { font-family: Fjalla, sans-serif; font-weight: bold; fill: #4b5568; }
]]>
</style>
</defs>
<g id="logo">
<text x="135" y="60" font-size="210" transform="rotate(45)">/</text>
<text x="115" y="363" font-size="210" transform="rotate(-45)">\</text>
<text x="15" y="341" font-size="200">build</text>
<text x="15" y="475" font-size="127">podcast</text>
<text x="21" y="540" font-size="36">screencasts on tech tools</text>
</g>
</svg>
Run Code Online (Sandbox Code Playgroud)
我正在使用img标签在主网站上显示它
<img src="logo.svg"> …Run Code Online (Sandbox Code Playgroud) 我正在开发一个当前部署到heroku 的简单应用程序 - 它正在使用mongoid,设备,并且可以在localhost中轻松创建用户登录,但不能在heroku中生成.您可以尝试创建一个帐户,并在提交后出错.
我认为我的mongoid.yml需要改变,但我不知道如何.
我heroku config有以下几点:
=== Config Vars for bookfoo
DATABASE_URL: postgres://jeibucpexp:bVZzGaGPUeGylwmA7dyE@ec2-107-20-186-97.compute-1.amazonaws.com/jeibucpexp
GEM_PATH: vendor/bundle/ruby/1.9.1
LANG: en_US.UTF-8
MONGOHQ_URL: mongodb://heroku:14bc6d476e6449c952d6350b07e89643@alex.mongohq.com:10065/app6153931
MONGOLAB_URI: mongodb://heroku_app6153931:og03dk0hdrj7r8lsit51k6ah9n@ds037097-a.mongolab.com:37097/heroku_app6153931
PATH: bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
RACK_ENV: production
RAILS_ENV: production
SHARED_DATABASE_URL: postgres://jeibucpexp:bVZzGaGPUeGylwmA7dyE@ec2-107-20-186-97.compute-1.amazonaws.com/jeibucpexp
Run Code Online (Sandbox Code Playgroud)
mongoid.yml在heroku中有以下建议:
development:
sessions:
default:
database: bookfoo_app_development
hosts:
- localhost:27017
options:
consistency: :strong
options:
test:
sessions:
default:
database: bookfoo_app_test
hosts:
- localhost:27017
options:
consistency: :strong
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
options:
skip_version_check: true
safe: true
Run Code Online (Sandbox Code Playgroud)
我的gemfile有以下内容:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
group :development, :test do …Run Code Online (Sandbox Code Playgroud) 我正在使用设计来进行新的用户注册.在创建新用户之后,我还想为该用户创建配置文件.
我的create方法registrations_controller.rb如下:
class RegistrationsController < Devise::RegistrationsController
def create
super
session[:omniauth] = nil unless @user.new_record?
# Every new user creates a default Profile automatically
@profile = Profile.create
@user.default_card = @profile.id
@user.save
end
Run Code Online (Sandbox Code Playgroud)
但是,它没有创建新的配置文件,也没有填写@ user.default_card的字段.如何在每个新用户注册时自动创建新的配置文件?
我已经设置了标题文字的样式:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as? TableViewCell
cell!.titleLabel!.text = sections[indexPath.section].objects[indexPath.row].name
cell!.datetimeLabel!.text = "on " + sections[indexPath.section].objects[indexPath.row].date
return cell!
}
func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 100
}
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return sections[section].heading // Open Events
}
Run Code Online (Sandbox Code Playgroud)
我想在表格单元格的部分开始之前在它下面添加一些边距/填充.我添加了一些边距/填充顶部heightForHeaderInSection.有没有办法添加一些上/下边距/填充?
我可以采取哪些步骤从之前完美运行的Git结帐树中彻底重新启动所有旧文件(删除新文件),正确迁移(删除新表/迁移)等等?
这是情况.我正在学习Rails,有几次我搞砸了,因此,我做了git checkout -f(没有提交任何东西)从完美的代码开始干净利落.但是,我发现新创建的文件仍然存在,我不得不手动删除它们,并且rake db:migrate错误地说表已经存在.
以下是我的一些错误:
Sayanee:depot sweska$ rake db:migrate
(in /Applications/XAMPP/xamppfiles/htdocs/rails_projects/TUTORIALS/depot)
== CreateUsers: migrating ====================================================
-- create_table(:users)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "hashed_password" varchar(255), "salt" varchar(255), "created_at" datetime, "updated_at" datetime)
(See full trace by running task with --trace)
Sayanee:depot sweska$ rake db:reset
(in /Applications/XAMPP/xamppfiles/htdocs/rails_projects/TUTORIALS/depot)
db/test.sqlite3 already exists
db/test.sqlite3 already exists
db/development.sqlite3 …Run Code Online (Sandbox Code Playgroud) 将我的应用程序重新部署到Heroku后,它会显示旧的public/index.html.我错过了什么?
我已完成以下步骤:
root :to => "homes#index" 我正在尝试从HTML5 Boilerplate运行构建脚本,我必须为此安装YUM.我在Mac OS Snow Leopard 10.6.8上.当我这样做时sudo port install yum,我收到以下错误.任何想法我怎样才能纠正它并正确安装yum?
---> Computing dependencies for py24-nose
---> Dependencies to be installed: py24-distribute
---> Activating py24-distribute @0.6.24_0 Error: Target org.macports.activate returned: Image error:
/opt/local/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg-info
already exists and does not belong to a registered port. Unable to
activate port py24-distribute. Use 'port -f activate py24-distribute'
to force the activation. Error: Failed to install py24-distribute Log
for py24-distribute is at:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py-distribute/py24-distribute/main.log
Error: The following dependencies were not installed: py24-distribute …Run Code Online (Sandbox Code Playgroud) 我需要{$user.unread}在我的*.tpl文件中以这种格式显示,而不需要任何for循环,这样只显示数字3.
我的php文件有$user = array('unread' => 3);什么应该是我的智能分配和php数组代码?
我这样做是为了将设计与智能代码集成,而无需与数据库连接.因此,{$user.unread}必须是在*.tpl文件中调用"3"或任何数字的格式,但在php文件中我可以定义一个静态数组并相应地调用smarty.我不确定php文件中的语法来定义这个静态数组并定义smarty assign.