Search Results

Search found 2028 results on 82 pages for 'constant'.

Page 11/82 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Missing a constant on load.. how can i get around this? (Rails::Plugin::OpenID)

    - by Chris Kimpton
    I have a Rails 2 project that I am trying to upgrade to Rails 3, but getting some issues with bundler. When I run "rake", it runs the tests just fine. But when I run "bundle exec rake" it fails to find a constant. The error is this: /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/dependencies.rb:131:in `const_missing': uninitialized constant Rails::Plugin::OpenID (NameError) from /Users/kimptoc/Documents/ruby/borisbikes/borisbikestats.pre3/vendor/plugins/open_id_authentication/init.rb:16:in `evaluate_init_rb' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:182:in `call' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:182:in `evaluate_method' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:166:in `call' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `run' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `each' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `send' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `run' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:276:in `run_callbacks' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:51:in `send' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:631:in `prepare_dispatcher' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:185:in `process' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:113:in `send' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:113:in `run' from /Users/kimptoc/Documents/ruby/borisbikes/borisbikestats.pre3/config/environment.rb:9 from ./test/test_helper.rb:2:in `require' from ./test/test_helper.rb:2 I have these gems installed: $ gem list *** LOCAL GEMS *** actionmailer (2.3.9) actionpack (2.3.9) activerecord (2.3.9) activeresource (2.3.9) activesupport (2.3.9) authlogic (2.1.3) bundler (1.0.7) gravtastic (2.2.0) linecache (0.43) mocha (0.9.10) newrelic_rpm (2.13.4) parseexcel (0.5.2) rack (1.1.0) rack-openid (1.1.1) rails (2.3.9) rake (0.8.7) ruby-debug-base (0.10.5.jb2, 0.10.4) ruby-debug-ide (0.4.15) ruby-openid (2.1.8, 2.1.7, 2.0.4) sqlite3-ruby (1.3.2) The bundler Gemfile is as follows: source 'http://rubygems.org' #gem 'rails', '3.0.3' gem "rails", "2.3.9" gem "activesupport", "2.3.9" gem "ruby-openid", "2.1.7", :require => "openid" #gem "authlogic-oid", "1.0.4" # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3-ruby', :require => 'sqlite3' gem "authlogic", "= 2.1.3" gem "newrelic_rpm" # gem "facebooker" gem "parseexcel" gem 'gravtastic', '= 2.2.0' gem "rack-openid", '=1.1.1', :require => 'rack/openid' # not sure what this does... gem "mocha" I have these plugins installed: 2dc_jqgrid authlogic_openid open_id_authentication squirrel I see these similar questions: Missing a constant on load.. how can i get around this? and Requiring gem in Rails 3 Controller failing with "Constant Missing" But their solutions dont seem to work for my situation. I am guessing the issue is around the plugins, but my ruby-foo is too weak. Thanks in advance, Chris

    Read the article

  • What is the right way to initialize a constant in Ruby?

    - by zbrimhall
    I have a simple class that defines some constants, e.g.: module Foo class Bar BAZ = "bof" ... Everything is puppies and rainbows until I tell Rake to run all my Test::Unit tests. When it does, I get warnings: bar.rb:3: warning: already initialized constant BAZ My habit has been to avoid these warnings by making the constant initialization conditional, e.g.: ... BAZ = "bof" unless const_defined? :BAZ ... This seems to solve the problem, but it is a little tedious, and I don't ever see anyone else initializing constants this way. This makes me think I might be Doing It Wrong. Is there a better way to initialize constants that won't generate warnings?

    Read the article

  • possible to make text messaging with php have a constant "telephone number" value?

    - by Rees
    hello, i have an iphone 3g and can successfully send text messages using the PHP mail() function. My issue is that for each message i receive, the "telephone number" associated with the incoming text message changes each time. If possible, I would like to somehow make this number constant so that I can take advantage of iphone's ability to aggregate all text messages from the same telephone number -Otherwise my iphone would be cluttered with messages. Is there a way to do this? an example of the numbers I receive would be 1(410) 000-001, 1(410) 000-002, 1(410) 000-003, etc... can i make this constant somehow? $message = stripslashes("new user just joined!"); mail("[email protected]", "Subject", "$message"); please let me know! thanks...

    Read the article

  • "Use of undefined constant CURLOPT_PROTOCOLS and CURLPROTO_HTTP" but it works?

    - by Dave
    Hi on our dev environment we have show all errors, warnings and notices. I'm getting this: Notice: Use of undefined constant CURLOPT_PROTOCOLS - assumed 'CURLOPT_PROTOCOLS' in C:\notion\implementation\development\asterix\library\ExternalLibs\panda.php on line 69 Notice: Use of undefined constant CURLPROTO_HTTP - assumed 'CURLPROTO_HTTP' in C:\notion\implementation\development\asterix\library\ExternalLibs\panda.php on line 69 The code on line 69: curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP); But the CURL code works, it goes off to the other server and retrieves whats necessary. What do these notices mean? Thanks very much.

    Read the article

  • How do I temporarily monkey with a global module constant?

    - by Daniel
    Greetings, I want to tinker with the global memcache object, and I found the following problems. Cache is a constant Cache is a module I only want to modify the behavior of Cache globally for a small section of code for a possible major performance gain. Since Cache is a module, I can't re-assign it, or encapsulate it. I Would Like To Do This: Deep in a controller method... code code code... old_cache = Cache Cache = MyCache.new code code code... Cache = old_cache code code code... However, since Cache is a constant I'm forbidden to change it. Threading is not an issue at the moment. :) Would it be "good manners" for me to just alias_method the special code I need just for a small section of code and then later unalias it again? That doesn't pass the smell test IMHO. Does anyone have any ideas? TIA, -daniel

    Read the article

  • Which HRESULT literal constant will fail the SUCCEEDED() macro?

    - by Hamish Grubijan
    Definition of SUCCEEDED(): #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) Background: When an Ok button is clicked on a dialog, I need to return an HRESULT value hr such that SUCCEEDED(hr) is true. If Cancel button is clicked, I need to return a negative value. I could have used bools, but that would break the existing pattern (usually the hr values come from depths of system dlls). So, I know I can return S_OK on Ok, but what do I return on Cancel? I could just return (HRESULT)-1;, but there must be a better way - some HRESULT literal constant which has negative value and represents a generic failure. S_FALSE is not it, for it's value is defined as 1L. Please help me find the right constant.

    Read the article

  • How to access constant defined in child class from parent class functions?

    - by kavoir.com
    I saw this example from php.net: <?php class MyClass { const MY_CONST = "yonder"; public function __construct() { $c = get_class( $this ); echo $c::MY_CONST; } } class ChildClass extends MyClass { const MY_CONST = "bar"; } $x = new ChildClass(); // prints 'bar' $y = new MyClass(); // prints 'yonder' ?> But $c::MY_CONST is only recognized in version 5.3.0 or later. The class I'm writing may be distributed a lot. Basically, I have defined a constant in ChildClass and one of the functions in MyClass (father class) needs to use the constant. Any idea?

    Read the article

  • Comparison between a value with static type Array and a possibly unrelated type Class

    - by Kaoru
    I got this error: Comparison between a value with static type Array and a possibly unrelated type Class. After i modify the class to many classes (before that, everything is on 1 class (all of the functions)), but after i move everything to many classes (all the functions is not on 1 class), that error appear. How to solve this? I am using AS3 and as3isolib Library. Here is the code after i modify the function: if (Constant.dude.y < Constant._numY) { if (Constant.dude.sprites != marioBackClass) { Constant.dude.sprites = [marioBackClass]; Constant.dudeDir = "Up"; } } Here is the code before i change the function to many classes: if (dude.y < ._numY) { if (dude.sprites.toString() != marioBackClass.toString()) { dude.sprites = [marioBackClass]; dudeDir = "Up"; } }

    Read the article

  • Keyboard is not detecting as3

    - by Kaoru
    i got this problem, when i press 1 in keyboard, the function does not run, even i already declared it. How do i solve this? Here is the code: public function Character() { Constant.loaderMario.load(new URLRequest("mario.swf")); addEventListener(KeyboardEvent.KEY_DOWN, selectingPlayer); } private function selectingPlayer(event:KeyboardEvent):void { isoTextMario = new Word(); isoTextChocobo = new Word(); if (event.keyCode == Keyboard.NUMBER_1|| event.keyCode == 49) { Constant.marioSelected = true; if (Constant.marioSelected == true) { isoTextMario.marioCharacter(); addChild(isoTextMario); } } else if (event.keyCode == Keyboard.NUMBER_2 || event.keyCode == 50) { Constant.chocoboSelected = true; if (Constant.chocoboSelected == true) { isoTextChocobo.chocoboCharacter(); addChild(isoTextChocobo); } } }

    Read the article

  • Ruby: how does constant-lookup work in instance_eval/class_eval?

    - by Alan O'Donnell
    I'm working my way through Pickaxe 1.9, and I'm a bit confused by constant-lookup in instance/class_eval blocks. I'm using 1.9.2. It seems that Ruby handles constant-lookup in *_eval blocks the same way it does method-lookup: look for a definition in receiver.singleton_class (plus mixins); then in receiver.singleton_class.superclass (plus mixins); then continue up the eigenchain until you get to #<Class:BasicObject>; whose superclass is Class; and then up the rest of the ancestor chain (including Object, which stores all the constants you define at the top-level), checking for mixins along the way Is this correct? The Pickaxe discussion is a bit terse. Some examples: class Foo CONST = 'Foo::CONST' class << self CONST = 'EigenFoo::CONST' end end Foo.instance_eval { CONST } # => 'EigenFoo::CONST' Foo.class_eval { CONST } # => 'EigenFoo::CONST', not 'Foo::CONST'! Foo.new.instance_eval { CONST } # => 'Foo::CONST' In the class_eval example, Foo-the-class isn't a stop along Foo-the-object's ancestor chain! And an example with mixins: module M CONST = "M::CONST" end module N CONST = "N::CONST" end class A include M extend N end A.instance_eval { CONST } # => "N::CONST", because N is mixed into A's eigenclass A.class_eval { CONST } # => "N::CONST", ditto A.new.instance_eval { CONST } # => "M::CONST", because A.new.class, A, mixes in M

    Read the article

  • Find existence of number in a sorted list in constant time? (Interview question)

    - by Rich
    I'm studying for upcoming interviews and have encountered this question several times (written verbatim) Find or determine non existence of a number in a sorted list of N numbers where the numbers range over M, M N and N large enough to span multiple disks. Algorithm to beat O(log n); bonus points for constant time algorithm. First of all, I'm not sure if this is a question with a real solution. My colleagues and I have mused over this problem for weeks and it seems ill formed (of course, just because we can't think of a solution doesn't mean there isn't one). A few questions I would have asked the interviewer are: Are there repeats in the sorted list? What's the relationship to the number of disks and N? One approach I considered was to binary search the min/max of each disk to determine the disk that should hold that number, if it exists, then binary search on the disk itself. Of course this is only an order of magnitude speedup if the number of disks is large and you also have a sorted list of disks. I think this would yield some sort of O(log log n) time. As for the M N hint, perhaps if you know how many numbers are on a disk and what the range is, you could use the pigeonhole principle to rule out some cases some of the time, but I can't figure out an order of magnitude improvement. Also, "bonus points for constant time algorithm" makes me a bit suspicious. Any thoughts, solutions, or relevant history of this problem?

    Read the article

  • how does [<Literal>] differ from other constants in F#

    - by Mitzh
    I am a bit confused by the Literal keyword and why it is necessary in F#. Reading the docs, it sounds to me that [<Literal>] is used to define a constant, however I am a bit confused how this constant differs from all other constants in F#.. Values that are intended to be constants can be marked with the Literal attribute. This attribute has the effect of causing a value to be compiled as a constant. When I think of a constant, I think of something which is immutable.... let x = "a" + "b" //this is a immutable value, its value is constant [<Literal>] let y = "a" + "b" //this is also a immutable value, but why is this a special constant? Is it because the 'normal' F# values are evaluated lazily and the [<Literal>] is not evaluated lazily..? is that what they mean with 'compiled as constant'..? or is there something else to it?

    Read the article

  • Basis for claim that the number of bugs per line of code is constant regardless of the language used

    - by Matt R
    I've heard people say (although I can't recall who in particular) that the number of bugs per line of code is roughly constant regardless of what language is used. What is the research that backs this up? Edited to add: I don't have access to it, but apparently the authors of this paper "asked the question whether the number of bugs per lines of code (LOC) is the same for programs written in different programming languages or not."

    Read the article

  • How do I declare an array as a constant in Objective-c?

    - by Andrew
    The following code is giving me errors: // constants.h extern NSArray const *testArray; // constants.m NSArray const *testArray = [NSArray arrayWithObjects: @"foo", @"bar"]; The error I get is initializer element is not constant Or if I take away the pointer indicator (*) I get: statically allocated instance of Objective-C class 'NSArray'

    Read the article

  • How to define a constant when running script/server?

    - by Zeke
    I want to start up my Rails development server like this: script/server OFFLINE_MODE=1 and have a method that checks for the presence of that constant: helper_method :offline_mode? def offline_mode? defined?(OFFLINE_MODE) ? true : false end so I can hide stuff in my app when I'm coding without access to the internet. For some reason though, OFFLINE_MODE doesn't ever seem to be defined and the method always returns false.. thoughts?

    Read the article

  • What's the simplest and most robust way to have constant-height submit button with rounded corners?

    - by taw
    Constant height so just left/right images should be necessary instead of having 4+, right? I'd still want top-to-bottom color gradient (and different one on hover). If possible, I'd prefer if it was still an <input type='submit'> and not anything weird. Is there any way (website / imagemagick script etc.) to generate these images automatically or do I need to draw them in some graphics program?

    Read the article

  • In Ada how do I initialise an array constant with a repeated number?

    - by mat_geek
    I need an array of 820 zeors for using with a mathematical function. In C I could just write the following and the compiler would fill the array: const float EMPTY_NUMBER_A[820] = { 0.0, }; However in Ada that isn't possible. I really don't want to hard code the 820 elements as 0.0. Is there a way to get the compiler to do it? type Number_A is array (1 .. 820) of Float; EMPTY_NUMBER_A : constant Number_A := something; Using Ada 95 and GNAT.

    Read the article

  • Java "constant string too long" compile error. Only happens using Ant, not when using Eclipse

    - by Allan
    I have a few really long strings in one class for initializing user information. When I compile in Eclipse, I don't get any errors or warnings, and the resulting .jar runs fine. Recently, I decided to create an ant build file to use. Whenever I compile the same class with ant, I get the "constant string too long" compile error. I've tried a number of ways to set the java compiler executable in ant to make sure that I'm using the exact same version as in Eclipse. I'd rather figure out how to get the same successful compile I get in Eclipse in Ant than try to rework the code to dynamically concatenate the strings.

    Read the article

  • How do I write a constant-space length function in Haskell?

    - by Bill
    The canonical implementation of length :: [a] -> Int is: length [] = 0 length (x:xs) = 1 + length xs which is very beautiful but suffers from stack overflow as it uses linear space. The tail-recursive version: length xs = length' xs 0 where length' [] n = n length' (x:xs) n = length xs (n + 1) doesn't suffer from this problem, but I don't understand how this can run in constant space in a lazy language. Isn't the runtime accumulating numerous (n + 1) thunks as it moves through the list? Shouldn't this function Haskell to consume O(n) space and lead to stack overflow? (if it matters, I'm using GHC)

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >