passenger

Codeforces #594 div1 C/div2 E – Queue in the Train

半腔热情 提交于 2019-12-03 21:03:27
题目链接: https://codeforces.com/contest/1239/problem/C 题意:火车上有n位乘客,按照1到n编号,编号为i的人会在ti分钟想去打水。水箱只能供一位乘客使用,每位乘客会使用p分钟。当一位乘客想要去打水时,他会先看编号在他前面的乘客是不是都在座位上,如果有人没在座位上,他会坐下继续等待,否则他会去排队打水。当某一时刻有几位乘客同时想要打水时,编号最小的乘客会前去打水,其他人会坐下继续等待,计算每位乘客打完水的时间。 做法:模拟。 按照题意模拟即可,具体实现见代码 。首先我们需要一个优先队列判断座位上的人谁先去打水,然后我们需要一个优先队列判断坐在座位上等待的人,接着我们需要一个队列模拟正在排队的人,最后我们需要一个数据结构记录空的座位。按照题意模拟即可,具体实现见代码。 参考代码: #include <iostream> #include <queue> #include <set> using namespace std; struct passenger { int pos, startime; } psger[100005]; struct cmp_waiting { bool operator()(const passenger &x, const passenger &y) { return x.pos > y.pos; } };

nginx rewrite rules with Passenger

99封情书 提交于 2019-12-03 18:05:00
I'm trying to migrate to nginx from Apache using Passenger in both instances to host a Rails app. The app takes a request, which is for an image- if the image exists at /system/logos/$requestedimage then it should get served, or it should be allowed to hit the Rails app to generate it if needed (where it is then cached to /system/logos). In Apache I used the following: RewriteCond %{DOCUMENT_ROOT}/system/logos/%{REQUEST_FILENAME} -f RewriteRule ^/(.*)$ http://assets.clg.eve-metrics.com/system/logos/$1 This worked fine. The assets. subdomain is another subdomain but with the same root, just

Rails 4.1 AWS Beanstalk cannot find secret key base

跟風遠走 提交于 2019-12-03 17:16:58
I am trying to upload my rails project on AWS Beanstalk. I've already run eb init, eb start and configured the database settings to point to RDS. After I pushed using git aws.push and waited for AWS server to be started, the link provided says: "502 Bad Gateway nginx" In the logs ------------------------------------- /var/app/support/logs/passenger.log ------------------------------------- App 6861 stderr: [ 2014-05-29 13:26:59.1308 6893/0x00000001e50050(Worker 1) utils.rb:68 ]: *** Exception RuntimeError in Rack application object (Missing `secret_key_base` for 'production' environment, set

Running Rails applications with Passenger alongside PHP applications

半腔热情 提交于 2019-12-03 16:02:55
I'm setting a server where I will need to run Ruby On Rails 3 applications along with some PHP websites. The server is a CentOS 5.8 machine running Apache 2.4.3. The server is for testing and PRE-production, so performance is not an issue. I'm using Phusion Passenger for the Rails apps, and I've created a bunch of virtual-hosts (with associated folders and DB accounts). Then, I'm planning to use other v-hosts for PHP. Is it possible? How should I proceed? Thank you very much details: httpd.conf: LoadModule passenger_module /app/auser/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/ext/apache2

Can't install passenger 3 on Snow Leopard (with RVM and ruby 1.9.2)

送分小仙女□ 提交于 2019-12-03 13:43:17
I've been trying to install passenger with no success yet. I've installed the gem, but when I run passenger-install-apache2-module it tells me This installer must be able to write to the following directory: /Users/myname/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0 But it can't do that, because you're running the installer as myname. Please re-run this installer as root. but if I do sudo passenger-install-apache2-module I get /Users/myname/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in `report_activate_error': Could not find RubyGem passenger (>= 0) (Gem::LoadError) from /Users

What user is running my Rails app?

£可爱£侵袭症+ 提交于 2019-12-03 13:41:21
问题 I'm trying to get a bare bones Rails app deployed under Apache, Passenger 3.0.0 and Rails 3.0.3. I'm getting all kinds of weird errors. mostly revolving around what I think is related to bundler or RAILS_ENV. Only non-default thing about the app is that development & test environments use SQLite3 and production uses MySQL. When hitting app from web browser Passenger is throwing errors regarding gems (sqlite3) that are specifically (in the Gemfile AND in the database.yml) declared as NOT part

You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3. Consider using bundle exec

左心房为你撑大大i 提交于 2019-12-03 13:10:00
问题 I've got a problem while i try to run my app : You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3. Consider using bundle exec. I read a lot about this kind of error, but i did not find any solution that worked for me I already removed my Gemfile.lock and re-run bundle as suggested here I already use the latest version of passenger (3.0.8) - as suggested here The bundle exec rake trick cannot be used in my case Thank you per advance 回答1: Run bundle install --binstubs

Can't get Flask running using Passenger WSGI on Dreamhost shared hosting

南笙酒味 提交于 2019-12-03 12:49:00
I'm trying to get a Flask "hello world" application working on a Dreamhost shared server, following the instructions on their wiki , but I'm not having any luck. My Flask application is the "hello world" one from the Flask quickstart guide : from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run() Which I've got in a file called "hello.py" in a folder called mysite, as per the DH wiki instructions. My passenger_wsgi.py file is: import sys, os INTERP = os.path.join(os.environ['HOME'], 'flask_env', 'bin', 'python'

Deploying Django app using passenger

主宰稳场 提交于 2019-12-03 12:46:36
I can get through everything on their wiki - and then I'm lost. http://wiki.dreamhost.com/Django I have a blank Django template, and whenever I try to change anything I get a 500 internal server error. I have completely developed my django app locally and just want to host it online - figured it would be easy but am slowly learning that it is not. I upload my app "videos" to this directory and then put it into the installed apps and ran "python manage.py syncdb", which finds no fixtures (which I Found odd). From there, it just gets an internal server error. Here is the error I am getting: http

Rails 3.1 application deployment tutorial

拥有回忆 提交于 2019-12-03 11:33:12
I'm looking for a good deployment tutorial for a Rails 3.1.1 application on a server. And by good I actually mean complete. The reason I'm posting this question is that although there are tons of tutorials out there on the web (google, blogs, books, other stackoverflow questions etc...) all of them seem to focus either on a problem with the deployment process or make some assumptions about the deployment environment that do not match with what I need. I realize that deploying a Rails app on a server requieres a variety of different programs and tools that need to be configured and somehow I