I have recently started using Zabbix release 2.0.7 and faced few issues
1) On the Zabbix page (for example : http://www.zabbix.com/rn2.0.7rc1.php ) I see that for there RC releases Zabbix says
"This release is not for production use. It is a Release Candidate!"
What is the meaning of release candidate if cannot be used for production release . May be I am not understanding Zabbix terminology here .
2) ok . Since Zabbix prohibited me from using its 2.0.7 rc1 release , I installed 2.0.7 and on my Zabbix PAGE I see the following errors though all triggers etc are getting captured perfectly fine .
What can i be doing wrong . I have taken all the rpms from zabbix download site & not changed a single line of code .
Constant UNRESOLVED_MACRO_STRING already defined [include/translateDefines.inc.php:24]
Constant HISTORY_OF_ACTIONS_DATE_FORMAT already defined [include/translateDefines.inc.php:27]
Constant EVENT_ACTION_MESSAGES_DATE_FORMAT already defined [include/translateDefines.inc.php:28]
Constant EVENT_ACTION_CMDS_DATE_FORMAT already defined [include/translateDefines.inc.php:29]
Constant HISTORY_LOG_LOCALTIME_DATE_FORMAT already defined [include/translateDefines.inc.php:30]
Constant HISTORY_LOG_ITEM_PLAINTEXT already defined [include/translateDefines.inc.php:31]
Constant HISTORY_PLAINTEXT_DATE_FORMAT already defined [include/translateDefines.inc.php:32]
Constant HISTORY_ITEM_DATE_FORMAT already defined [include/translateDefines.inc.php:33]
Constant EVENTS_DISCOVERY_TIME_FORMAT already defined [include/translateDefines.inc.php:34]
Constant EVENTS_ACTION_TIME_FORMAT already defined [include/translateDefines.inc.php:35]
Constant QUEUE_NODES_DATE_FORMAT already defined [include/translateDefines.inc.php:36]
Constant CHARTBAR_HOURLY_DATE_FORMAT already defined [include/translateDefines.inc.php:37]
Constant CHARTBAR_DAILY_DATE_FORMAT already defined [include/translateDefines.inc.php:38]
Constant REPORT4_ANNUALLY_DATE_FORMAT already defined [include/translateDefines.inc.php:40]
Constant REPORT4_MONTHLY_DATE_FORMAT already defined [include/translateDefines.inc.php:41]
Constant REPORT4_DAILY_DATE_FORMAT already defined [include/translateDefines.inc.php:42]
Constant REPORT4_WEEKLY_DATE_FORMAT already defined [include/translateDefines.inc.php:43]
Constant REPORTS_BAR_REPORT_DATE_FORMAT already defined [include/translateDefines.inc.php:45]
Constant POPUP_PERIOD_CAPTION_DATE_FORMAT already defined [include/translateDefines.inc.php:46]
Constant MAPS_DATE_FORMAT already defined [include/translateDefines.inc.php:47]
Constant SERVER_INFO_DATE_FORMAT already defined [include/translateDefines.inc.php:48]
Constant XML_DATE_DATE_FORMAT already defined [include/translateDefines.inc.php:49]
Constant XML_TIME_DATE_FORMAT already defined [include/translateDefines.inc.php:50]
Release candidate in any terminology usually means that the software "should work" however, the vendor doesn't guarantee 100% stability and lack of errors.
Most probably you have some leftovers from the previous installation. The PHP error you get usually means that some file was included twice or a file from different version was included.
I strongly advice to use the packages from your distribution.
Related
I have initializers config in my rails application under config/initializers/my_config.rb.
What is the difference between:
A:
module MyModule
Config = "path/to/config.yml"
end
and:
B:
MyModule::Config = "path/to/config.yml"
Let's suppose we do some requests, change its implementation, and hit the application again. If I defined my constant the B way, I get an error:
uninitialized constant MyModule::Config
It will be resolved only when I restart my rails server. But when I do the A way, it still recognized the constant when I updated my code.
What is the importance of using the A syntax in this case?
Part of this seems to have to do with rails hot code reloading, which has a bunch of caveats. If you aren't using hot code reloading, A and B are more equivalent, as long as MyModule has been defined first.
However, when code is reloaded, (particularly the file that defines MyModule), it might end up overwriting the existing module, and not running the B line.
The main difference though, is that A doesn't rely on how the order of other code in the project is loaded/run, but B must be run after certain code.
The differences is that code A raises a syntax error, while code B is grammatical. Code B will raise a name error for MyModule unless it is previously defined, though.
From the documentation: http://neo4jrb.readthedocs.io/en/8.0.x/Setup.html
neo4j_adaptor = Neo4j::Core::CypherSession::Adaptors::HTTP.new('http://user:pass#host:7474')
Neo4j::ActiveBase.on_establish_session { Neo4j::Core::CypherSession.new(neo4j_adaptor) }
I get:
NameError: uninitialized constant Neo4j::Core::CypherSession
To fix, I added (not documented in the above):
require 'neo4j/core/cypher_session/adaptors/http'
The error changes (the first line works):
Neo4j::ActiveBase.on_establish_session { Neo4j::Core::CypherSession.new(neo4j_adaptor) }
NameError: uninitialized constant Neo4j::ActiveBase
Is there a better place to see how to set up working with a heroku-based grapheneDB? I keep hitting undocumented errors when doing a cut-and-paste of the set up.
Thanks for pointing out the missing require. I've just added it (also feel free to click "Edit on GitHub" at the top to start a pull request if you notice anything else)
Have you done a require "neo4j"? That should bring in ActiveBase and all of the ActiveNode / ActiveRel stuff. If that works I can add that to the docs as well
Reading this really good article on Rails namespacing and module lookup. Here
I don't understand what this means:
If constants are loaded only when they’re first encountered at
runtime, then by necessity their load order depends on the individual
execution path.
What is the individual execution path?
I think that non-understand leads me to not understand this:
As soon as an already-loaded constant Baz is encountered, Rails knows
this cannot be the Baz it is looking for, and the algorithm raises a
NameError.
or more importantly this:
The first time, as before, is down to the loss of nesting information.
Rails can’t know that Foo::Qux isn’t what we’re after, so once it
realises that Foo::Bar::Qux does not exist, it happily loads it.
The second time, however, Foo::Qux is already loaded. So our reference can’t have been to that constant, otherwise Ruby would have
resolved it, and autoloading would never have been invoked. So the
lookup terminates with a NameError, even though our reference could
(and should) have resolved to the as-yet-unloaded ::Qux.
Why doesn't rails use the constant that is encountered that is already loaded? Also why does running:
Foo::Bar.print_qux
twice lead to two different outcomes?
By "execution path" they mean the way your code is running. If there's a reference to a class X::Y inside an if block that isn't executed, that means your execution path bypasses it so it's not loaded.
This is different than force-loading all classes referenced in your code at parse time. They're simply loaded as they're exercised if and only if that given line of code is executed.
The autoloader has a strategy for trying to load modules starting with the most specific and then looking for increasingly global names. Qux is tested against the current module context, then the root of that and so on. This is how symbols are resolved.
In that example the auto-loaded version actually pushes the Foo::Qux definition ahead of ::Qux in terms of priority. That's the major change there.
I have a model named 'Task' in my project.
I upgraded from Rails 3.0 to Rails 3.1 and now I receive the following error. My code hasn't changed.
>> Task.new
WARNING: Deprecated reference to top-level constant 'Task' found at: /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2470:in `rakefile_location'
Use --classic-namespace on rake command
or 'require "rake/classic_namespace"' in Rakefile
ArgumentError: wrong number of arguments (0 for 2)
from (irb):1:in `initialize'
from (irb):1:in `new'
from (irb):1
I'm scared I've called my model something that should have been reserved, what should I do for best practice? Refactor and change the name? Or something else?
Update: I tried it's suggestion of updating the Rakefile, but this did not work.
In the end, it turns out 'Task' has been a reserved word for a long time. I used text mate's find and replace to do a refactor, and created migrations to update the database. It only took about an hour, and I feel it was worthwhile to avoid future problems.
I dug a bit deeper and found this out:
When my specs auto-load the Task constant, Rake's const_missing (source code) kicks in, issues that warning (source code) and returns Rake::Task. Which makes my specs fail because I'm now testing that instead of my model.
I then get a lot of these:
NoMethodError:
undefined method `enqueue' for Rake::Task:Class
Well, of course it doesn't implement enqueue — that's not my model!
So, in short, Rake tells me not to use their top-level Task (even though I didn't mean to), and provides me with a different constant, effectively breaking the auto-loading in Rails!
There's only way around that — I had to manually require 'task' in the spec. Now it's all ponies and rainbows.
Dear Jim Weinrich, if you read this: Next time you declare something deprecated, please ensure that you only warn people about this when they actually use a deprecated API!
Another way to handle this is to get rid of rake's deprecation warning. In your spec_helper, before any activity that would reference the model, do this:
# Rake defines a const_missing that, if you reference any of several
# top-level constants, issues a deprecation warning and then defines
# it. Since Rake defines it, rail's own const_missing doesn't
# happen, and our own class doesn't get loaded. The workaround is to
# remove rake's const_missing.
class Module
def const_missing(*args)
rake_original_const_missing(*args)
end
end
We could have renamed our model, but that was more work than this. This, however, might break with future versions of rake. Choose your poison.
I'm upgrading my Rails app to work with Ruby 1.9 and I keep encountering errors like this:
Anonymous modules have no name to be referenced by
/home/foo/.gem/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:585:in `to_constant_name'
/home/foo/.gem/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:391:in `qualified_name_for'
/home/foo/.gem/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:104:in `rescue in const_missing'
/home/foo/.gem/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:94:in `const_missing'
/home/foo/app/config/environment.rb:66:in `block in <top (required)>'
etc.
Google finds all kinds of hits for this, but each of them pertains to a specific fix for one specific gem or app. None of them explain what the message really means.
What is an "anonymous module"?
Where is this error message coming from? (The Ruby interpreter itself?)
What is different about Ruby 1.9 that causes this? (Rails 2.3.8 with Ruby 1.8.7 does not encounter this.)
What is the general/proper way to fix this error?
Line 66 of environment.rb is the configuration for super_exception_notifier (old version, 2.0.8):
ExceptionNotifier.configure_exception_notifier do |config|
config[:sender_address] = %("Foo" <foo#foo.com>)
config[:exception_recipients] = %w(foo#foo.com)
config[:skip_local_notification] = false
end
From what I can tell, ExceptionNotifier is undefined, and ActiveSupport is trying to magically load it, but fails and then fails again trying to print a nice error message.
An anonymous module is a module that is declared like so:
Fred = Module.new do
def meth1
"hello"
end
def meth2
"bye"
end
end
instead of by using the regular Module mod_name <block> syntax. Since they have no module name, you can't retrieve the module name. to_constant_name is attempting to call desc.name.blank? where desc is an anonymous module (with no name).
This error is coming from the ActiveSupport module, which may indicate a bug in the active_support gem or may indicate that some other piece of code is using ActiveSupport incorrectly. The error message alone doesn't give enough information to identify the culprit (to me at least, someone with more rails experience might be able to provide more insight).
Without knowing the offending code it's also hard to say exactly why this error is popping up with 1.9, or what needs to be done to fix it. Considering that there are a lot of un- and under-maintained gems out there that have not been updated for 1.9 yet, I would suspect that ActiveSupport is not the source of the problem. Upgrade all of your gems that have 1.9-compatible versions, and then try disabling your other gems one at a time (if you can) and see if you still get the error.
If you provide a list of the other gems that you are using, someone else who may have encountered the error before may be able to provide some details.
This may happen if you try to exploit ActiveRecord's internal class and module contexts in the wrong way. I had this error yesterday while working on a gem which extends deep inner workings of ActiveRecord. I finally managed to get around this problem by redesigning my code which exploits the inner contexts. It would be interesting to see the surrounding lines of environment.rb:66 for further analysis.
This may happen when the class name doesn't match the filename, in
my case it was a file named application.rb contaning the ApplicationController
class. Renaming the file to application_controller.rb solved the problem.
When I got this error, it was due to a misspelling while defining a class. If you are getting this error, it may be worth examining your module and class definitions for typos.