我想$data从命名的控制器传递poll 到results_view但是我得到一个未定义的变量错误.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Poll extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper('form');
}
public function index()
{
$this->load->view('poll_view',$data);
}
public function vote()
{
echo "Voting Successfull";
$this->db->insert('votes',$_POST);
}
public function results()
{
echo "These are the results";
//$query = $this->db->get('votes');
$data = "hello";
$this->load->view('results_view', $data);
}
}
Run Code Online (Sandbox Code Playgroud)
Results_view.php
<html>
<?php echo $data; ?>
</html>
Run Code Online (Sandbox Code Playgroud) 我有一个Zebra GK420d通过CUPS连接到OS X. 但是,当我发送用ZPL或EPL编写的文件时,它们只以纯文本形式打印.
我需要在打印机上更改模式吗?
我正在使用Oauth2 Gem连接到服务。
我可以收到授权代码,但是当我使用该代码检索用户令牌时,会得到Faraday :: ConnectionFailed(到达文件末尾):
其他大多数问题都归因于过时的证书。但是,当我部署到Heroku时,此错误仍然存在。
client = OAuth2::Client.new(client_id, client_secret, :site => 'https://auth.mxit.com', :authorize_url => '/authorize', :token_url => '/token')
auth_code1 = client.auth_code.authorize_url(:redirect_uri => root_url+'oauth2/callback', :scope => 'message/send')
auth_code1 =params[:code]
base_code = Base64.encode64(client_id+' : '+client_secret)
token = client.auth_code.get_token(auth_code1, :redirect_uri => root_url+'oauth2', :grant_type =>'authorization_code', :headers => {'Content-Type' => 'application/x-www-form-urlencoded','Authorization' => 'Basic'+base_code })
Run Code Online (Sandbox Code Playgroud) 我在 AWS Elastic Beanstalk 上使用 Rails 5.2.3 运行 Sidekiq。按照我设置的Sidekiq wiki中的说明进行操作initializers/sidekiq.rb:
Sidekiq.configure_server do |config|
config.logger.level = Logger::WARN
end
Run Code Online (Sandbox Code Playgroud)
这在开发环境中有效,但在生产环境中 Sidekiq 仍在调试级别生成日志。Rails 生产记录器级别设置为config.log_level = :warn
ruby ruby-on-rails amazon-ec2 sidekiq amazon-elastic-beanstalk
我正试图让上帝启动我的resque队列.但是,当我运行god load config/resque.god它返回The server is not available (or you do not have permissions to access it)
这是我的resque.god文件:
rails_env = ENV['RAILS_ENV'] || "production"
rails_root = ENV['RAILS_ROOT'] || "/Users/andrewlynch/sites/wellness/wellbot"
God.watch do |w|
w.name = "resque-worker"
w.group = "resque"
w.interval = 60.seconds
w.dir = "#{rails_root}"
w.start = "RAILS_ENV=development QUEUE=* rake resque:work"
w.start_grace = 30.seconds
end
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用内置于Graphite中的AMQP将RabbitMQ连接到Graphite.但是当我取消注释carbon.conf我得到的设置时:
notroot@ubuntu:/opt/graphite/bin$ sudo python carbon-cache.py start
Starting carbon-cache (instance a)
Traceback (most recent call last):
File "carbon-cache.py", line 30, in <module>
run_twistd_plugin(__file__)
File "/opt/graphite/lib/carbon/util.py", line 92, in run_twistd_plugin
runApp(config)
File "/usr/lib/python2.7/dist-packages/twisted/scripts/twistd.py", line 23, in runApp
_SomeApplicationRunner(config).run()
File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 386, in run
self.application = self.createOrGetApplication()
File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 446, in createOrGetApplication
ser = plg.makeService(self.config.subOptions)
File "/opt/graphite/lib/twisted/plugins/carbon_cache_plugin.py", line 21, in makeService
return service.createCacheService(options)
File "/opt/graphite/lib/carbon/service.py", line 115, in createCacheService
root_service = createBaseService(config)
File "/opt/graphite/lib/carbon/service.py", line 50, in createBaseService
from …Run Code Online (Sandbox Code Playgroud) 我正在尝试将Dashing部署到Heroku.Everthing在localhost上完美运行.使用github页面提供的说明进行部署
它似乎与backports宝石有关.
以下是heroku日志文件
2014-11-26T21:12:22.141799+00:00 heroku[web.1]: State changed from crashed to starting
2014-11-26T21:12:32.932667+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e production -p 23294`
2014-11-26T21:12:40.618062+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/1.9.1/io/open.rb:2:in `close': Bad file descriptor - /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/1.9.1/io/open.rb (Errno::EBADF)
2014-11-26T21:12:40.618144+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/1.9.1/io/open.rb:2:in `<top (required)>'
2014-11-26T21:12:40.618185+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/tools.rb:343:in `require_with_backports'
2014-11-26T21:12:40.618165+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/tools.rb:343:in `require'
2014-11-26T21:12:40.618206+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/tools.rb:22:in `block in require_relative_dir'
2014-11-26T21:12:40.618123+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/1.9.1/io/open.rb:2:in `open'
2014-11-26T21:12:40.618261+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/1.9.1/io.rb:3:in `<top (required)>'
2014-11-26T21:12:40.618392+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/tools.rb:343:in `require'
2014-11-26T21:12:40.618224+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/backports-3.6.0/lib/backports/tools.rb:21:in …Run Code Online (Sandbox Code Playgroud)