有没有办法预处理文本文件并跳过这些字符?
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa1 in position 1395: invalid start byte
Run Code Online (Sandbox Code Playgroud) 我第一次尝试将我的rails应用程序部署到Heroku,遇到了很多问题.应用程序崩溃,您可以查看映像中的日志:http
://i.stack.imgur.com/bsx1b.png
更糟糕的是,当我尝试在本地查看我的应用程序时,它无法在postgreSQL环境中工作当我回到database.yml中使用sqLite3时工作正常.我认为问题可能是我实际上必须安装postgreSQL,除了添加pg gem和运行bundle install.
我继续使用一键安装程序(Windows 7 64位)安装PostgreSQL.重启后,一个简单的rails服务器或bundle install命令开始失败,所以我重新安装了整个ruby和rails.
现在rails server命令工作正常,当我尝试在本地环境中查看我的应用程序时,它会提示不同的错误.所以现在我有pgAdmin III和Rails
PG::Error
fe_sendauth: no password supplied
Run Code Online (Sandbox Code Playgroud)
我试着遵循这个,但我找不到"pg_hba.conf".我想答案是基于不同的操作系统.
而现在再次,捆绑器不工作,给我错误......
问题: 1)使用一键安装程序安装postgreSQL是否正确?因为这导致我的ROR以某种方式"崩溃",我不得不重新安装rails.2)我想我将删除与postgreSQL相关的所有内容,重新安装Rails,并从头开始.我必须采取哪些步骤?我看过的所有参考文献似乎都不适合Windows环境.
在我的gemfile中,我有
gem 'pg'
gem 'thin'
Run Code Online (Sandbox Code Playgroud)
在我的数据库中,我有
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: postgresql
encoding: utf8
database: mangfeel_development
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your …Run Code Online (Sandbox Code Playgroud) 我认为问题是我使用的是SQLite3,所以我迁移到了PostgreSQL,但问题仍然存在.该应用程序在本地工作正常 我用heroku打开我的应用程序,它给了我以下错误:
Application Error. An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details..
Run Code Online (Sandbox Code Playgroud)
我试图通过查看日志找到解决方案但失败了,所以我需要别人的帮助.这是我的日志,我感谢任何帮助!
2012-11-19T00:55:37+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e production -p 3545`
2012-11-19T00:55:39+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them …Run Code Online (Sandbox Code Playgroud) 问题:我安装了ruby,但无法正确识别. 我正在关注部署到VPS:https://github.com/railscasts/335-deploying-to-a-vps
我在ubuntu 12.04 LTS上设置我的服务器来部署我的rails应用程序.我正在跟踪部署到VPS的railscast,并试图通过rbenv安装ruby.似乎一切都安装正确,但当我试图检查ruby版本时,它给了我错误.以下是我运行的命令.
deployer@max:~$ rbenv install 1.9.3-p125
Downloading yaml-0.1.4.tar.gz...
-> http://cloud.github.com/downloads/sstephenson/ruby-build-download-mirror/36c852831d02cf90508c29852361d01b
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /home/deployer/.rbenv/versions/1.9.3-p125
Downloading ruby-1.9.3-p125.tar.gz...
-> http://cloud.github.com/downloads/sstephenson/ruby-build-download-mirror/e3ea86b9d3fc2d3ec867f66969ae3b92
Installing ruby-1.9.3-p125...
Installed ruby-1.9.3-p125 to /home/deployer/.rbenv/versions/1.9.3-p125
Downloading rubygems-1.8.23.tar.gz...
-> http://cloud.github.com/downloads/sstephenson/ruby-build-download-mirror/178b0ebae78dbb46963c51ad29bb6bd9
Installing rubygems-1.8.23...
Installed rubygems-1.8.23 to /home/deployer/.rbenv/versions/1.9.3-p125
deployer@max:~$ rbenv global 1.9.3-p125
deployer@max:~$ ruby -v
'ruby' program can be found in the following packages:
* ruby1.8
* ruby1.9.1
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
$container.infinitescroll({
navSelector : "div.navigation",
nextSelector : "div.next-page a:first",
itemSelector : "#posts-container div.post",
bufferPx : 80
},
function( newElements ) {
var $newElems = $ ( newElements );
$container.masonry( 'appended', $newElems );
}
);
Run Code Online (Sandbox Code Playgroud)
在实现infiniteScroll插件时,我newElements实际上并没有真正知道它是什么.在提供的代码中,我newElements作为参数传入,但它没有在上面的任何地方声明.但是,功能正常; 新的帖子元素存储在$newElems.
当我使用时newElements,我是否方便地将所有新添加的元素调用到DOM中?
用该设备拍摄的照片很大。我想在将它们调整大小(缩放它们)到更合理的大小(小于 800x800)后将它们上传到我的后端服务器。我希望使用ImageEditor模块的coprImage()功能,但是使用大图像运行它会导致OutOfMemory异常。我假设由于模块尝试解码大图像并将其存储在内存中,因此应用程序崩溃了。
我需要的是以下内容:
输入
{
width: 3100,
height: 2500,
uri: content://android/1 (some location in Android device)
}
Run Code Online (Sandbox Code Playgroud)
输出
{
width: 800,
height: 650,
uri: content://android/1/resized (some location in Android device)
}
Run Code Online (Sandbox Code Playgroud)
然后我可以抓取这个 uri 将图片发送到我的后端服务器,并从设备中删除调整大小的照片。
我假设我将不得不编写一个NativeModule这样我就可以调整图像大小而无需将大的解码图像加载到内存中。React Native 的Image组件在渲染它们之前使用Fresco来处理调整大小,但我认为它没有提供一种调整图像大小并将其临时保存在 fs 中的方法。
任何帮助,将不胜感激。
参考:
在LessonsController中,有new和create方法.
def new
@lesson = Lesson.new
end
def create
@lesson = Lesson.new(params[:lesson])
if @lesson.save do something end
end
Run Code Online (Sandbox Code Playgroud)
我一直在我的应用程序中这样做而没有想到.它有效,但我很困惑为什么我在new和create动作中创建实例变量.据我了解,这是流程:
当用户点击该new lesson按钮时,他将被定向到LessonsController#new.当他输入所需的值并点击时submit他会被引导到LessonsController#create.我不需要该create方法的视图模板.
所以我的困惑是,为什么你@lesson在create方法中再次创造对象?我认为这个问题的答案可能要涉及的一些概念GET和POSTHTTP方法为好.
我感谢任何帮助!谢谢.
在下面的代码中,
if (options.max) {
if (i <= options.max) $(x).addClass("hey");
}
else {
if (i >= options.min) $(x).addClass("no"); //<- this
}
Run Code Online (Sandbox Code Playgroud)
从上面删除每个花括号使第二个子句(标记为<- this)不起作用.
if (options.max)
if (i <= options.max) $(x).addClass("hey");
else
if (i >= options.min) $(x).addClass("no"); //<- this
Run Code Online (Sandbox Code Playgroud)
我认为JavaScript中的if语句的单个表达式可以在没有花括号的情况下使用.为什么会这样?
javascript ×2
jquery ×2
android ×1
deployment ×1
get ×1
heroku ×1
install ×1
post ×1
postgresql ×1
python ×1
rbenv ×1
react-native ×1
ruby ×1
sqlite ×1