Search Results

Search found 8286 results on 332 pages for 'defined'.

Page 15/332 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Add static const data to a struct already defined

    - by Kyle
    Since static const data inside a class is really just namespace sugar for constants I would think that struct A { float a; struct B { static const int b = a; }; }; would be equivalent to struct A { float a; }; struct A::B { static const int b = a; }; or something similar. Is something like this possible in C++? It would be useful for me to be able to tag class definitions that I'm pulling in from third party libraries with information like this.

    Read the article

  • PHP Extract Values From One String Based on a Pattern Defined in Another

    - by ironkeith
    I have two strings: $first = '/this/is/a/string'; $second = '/this/:param1/a/:param2'; And I'm trying to get this: $params = array('param1' => 'is', 'param2' => 'string'); But getting from point a to b is proving more than my tired brain can handle at the moment. Anything starting with a ':' in the second string defines a variable name/position. There can be any number of variables in $second which need to be extracted from $first. Segments are separated by a '/'. Thanks.

    Read the article

  • Using scope, defined in parent model, inside it's child (STI pattern)

    - by Anton
    I implement a class hierarchy using STI pattern class A scope :aaa, where([someField]:[someValue]) end class B < A end The problem is that when I try to call something like: B.limit(5).aaa => SELECT "[table]".* FROM "[table]" WHERE "[table]"."type" IN ('A') AND ([someField] = [someValue]) LIMIT 5 So I am getting 5 objects of type A, which satisfies scope :aaa But I need to do the same with rows where type = "B" Is there any way to use scopes from parent, without redifinning it in childs in STI pattern? Thanks in advance EDITED I just discussed it with my frind and he showed me one important thing. A in not the root class of STI. IN fact whole hierarchy looks like class O < ActiveRecord::Base end class A < O scope ..... ..... end class B < A end maybe the reason is in hierarchy itself?...

    Read the article

  • Is the "==" operator required to be defined to use std::find

    - by user144182
    Let's say I have: class myClass std::list<myClass> myList where myClass does not define the == operator and only consists of public fields. In both VS2010 and VS2005 the following does not compile: myClass myClassVal = myList.front(); std::find( myList.begin(), myList.end(), myClassVal ) complaining about lack of == operator. I naively assumed it would do a value comparison of the myClass object's public members, but I am almost positive this is not correct. I assume if I define a == operator or perhaps use a functor instead, it will solve the problem. Alternatively, if my list was holding pointers instead of values, the comparison would work. Is this right or should I be doing something else?

    Read the article

  • Codeigniter: user defined helper function does not load.

    - by cbrandolino
    Hi everybody. I made a custom helper extending the system string_helper.php. I placed it in my /application/helpers folder, called MY_string_helper.php as required, unit-tested its functions. Now, when I try to call one of its functions from a model, it does not work. The functions in the default string helper work, instead. It looks like my extension is not loaded for some reasons. Thanks a lot, and happy holidays.

    Read the article

  • Google maps api Directions User defined Steps

    - by Via Lactea
    Hi All, I have a google map service with the stores mapped on it. I also have directions service (then you define two addresses or more and it shows you a way on this map, see google map api directions). So I wa?? to show the nearest stores to this way. Of course it could be the store located in the next streat of my way, so it also should be included to the list. So far I just found only an array of steps in the directions object which I get from google maps api. But these steps are predefined by google, so they can be too close one each to other and they also can be too far (if a part of your route is a highway or there is no any special steps on your way etc.) So, what I want to do. I want to make my own steps on the line that I get from google directions (for example to put these steps on my line every 500 meeters etc.), and after that to search every step for any stores around 200 meeters. Is it possible to do? I cannot find any solution of this idea in internet.

    Read the article

  • What's wrong with my self-defined init method?

    - by user313439
    In ClassA: - (ClassA *)initWithID:(NSString *) cID andTitle:(NSString *) cTitle { ClassAID = cID; ClassATitle = cTitle; return self; } In ClassB: - (void)cellDidSelected { ClassA *classAController = [[ClassA alloc] init]; //Program received signal: “EXC_BAD_ACCESS” when executing the following line. classAController = [classAController initWithClassAID:ClassAID andClassATitle:ClassATitle]; NSLog(@"I want to get the value of ID:%@ and Title:%@ here.", [classAController ClassATitle], [classAController ClassAID]) } Could anyone point where is wrong? Thanks a lot.

    Read the article

  • $ is not defined in Firefox using jQuery

    - by Alvin
    Hi, Whenever I try to load the following part in <head> tag on firfox browser, I get the message as $ is not define. May I know the reason? I'm trying to load the jquery.js file before loading any custom script after CSS part. <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){

    Read the article

  • [Perl] Use a Module / Object which is defined in the same file

    - by Robert S. Barnes
    I need to define some modules and use them all in the same file. No, I can't change the requirement. I would like to do something like the following: { package FooObj; sub new { ... } sub add_data { ... } } { package BarObj; use FooObj; sub new { ... # BarObj "has a" FooObj my $self = ( myFoo => FooObj->new() ); ... } sub some_method { ... } } my $bar = BarObj->new(); However, this results in the message: Can't locate FooObj.pm in @INC ... BEGIN failed... How do I get this to work?

    Read the article

  • C# property exactly the same, defined in two places

    - by Sarah Vessels
    I have the following classes: Defect - represents a type of data that can be found in a database FilterQuery - provides a way of querying the database by setting simple Boolean filters Both Defect and FilterQuery implement the same interface: IDefectProperties. This interface specifies particular fields that are in the database. Different classes have methods that return lists of Defect instances. With FilterQuery, you specify some filters for the particular properties implemented as part of IDefectProperties, and then you run the query and get back a list of Defect instances. My problem is that I end up implementing some properties exactly the same in FilterQuery and Defect. The two are inherently different classes, they just share some of the same properties. For example: public DateTime SubmitDateAsDate { get { return DateTime.Parse(SubmitDate); } set { SubmitDate = value.ToString(); } } This is a property required by IDefectProperties that depends on a different property, SubmitDate, which returns a string instead of a DateTime. Now SubmitDate is implemented differently in Defect and FilterQuery, but SubmitDateAsDate is exactly the same. Is there a way that I can define SubmitDateAsDate in only place, but both Defect and FilterQuery provide it as a property? FilterQuery and Defect already inherit from two different classes, and it wouldn't make sense for them to share an ancestor anyway, I think. I am open to suggestions as to my design here as well.

    Read the article

  • Elegant way to add functionallity to previously defined functions

    - by Bastiaan
    How to combine two functions together I have a class controlling some hardware: class Heater() def set_power(self,dutycycle, period) ... def turn_on(self) ... def turn_off(self) And a class that connects to a database and handles all data logging fuctionallity for an experiment: class DataLogger() def __init__(self) # Record measurements and controls in a database def start(self,t) # Starts a new thread to aqcuire and reccord measuements every t secconds Now, in my program recipe.py I want to do something like: log = DataLogger() @DataLogger_decorator H1 = Heater() log.start(60) H1.set_power(10,100) H1.turn_on() sleep(10) H1.turn_off() etc Where all actions on H1 are recorded by the datalogger. I can change any of the classes involved, just looking for an elegant way to do this. Ideally the hardware functions remain separated from the database and DataLogger functions. And ideally the DataLogger is reusable for other controls and measurements.

    Read the article

  • sql user defined function

    - by nectar
    for a table valued function in sql why cant we write sql statements inside begin and end tags like- create function dbo.emptable() returns Table as BEGIN --it throws an error return (select id, name, salary from employee) END go while in scalar valued function we can use these tags like create function dbo.countemp() returns int as begin return (select count(*) from employee) end go is there any specific rule where we should use BEGIN & END tags

    Read the article

  • Get node parent of defined type using xpath

    - by IordanTanev
    Hi, i will give an example of the problem i have. My XML is like this <roor> <child Name = "child1"> <node> <element1>Value1</element1> <element2>Value2</element2> </node> </child> <child Name = "child2"> <element1>Value1</element1> <element2>Value2</element2> <element3>Value3</element3> </child> </root> I have xpath expression that returns all "element2" nodes. Then i want to for every node of type "element2" to find the node of type "child" that contains it. The problem is that between these two nodes there can be from 1 to n different nodes so i can't just use "..". Is there something like "//" that will look up instead of down Best Regards, Iordan

    Read the article

  • why i got : ReferenceError: $ is not defined $.ajax({

    - by user2922621
    i need to call phpfile through ajax.. i tried \::; <html> <script type="text/javascript"> setInterval(function(){ test(); },3000); function test(){ $.ajax({ type: "POST", url: "GetMachineDetail.php", data: "{}", success: function(response){ alert("suceccess");} }); } Its simple javascript jquery calling.. but we got ajax not found eror, any solution please.

    Read the article

  • return only one document for each filter defined in the query

    - by Garytxo
    Hi all, In one of my latest projects I use Solr 1.4 for searching products.However I have ran into a slight problem, which I aint sure if its possible to do using Solr. All products are indexed by "country" and "category" and the "id", "class" and "description" are stored values. I now have been requested to extract a sample list of products that we have for a give "category" and "ONLY RETURNING ONE" product for each country where the product is available. In my current implementation, I have a dismax query to get a list of all the countries that correspond to the catergory, then I call again solr to extract all products for each country, limiting the no. rows by the size of the countries found in the previous query. The problem I have with this current implementation is I can not be certain that I have one product for each country in the list. Therefore would anyone know if it possible to tell solr that you want only one product per country provided in the query? Any guidance would be useful.

    Read the article

  • on and off the user defined notification in status bar

    - by sairam333
    Hi i am displaying some alert message in the status bar depending up on my application condition.up to this the alert is displayed properly.But now i want if notification icon is appeared in the status bar when i saw once it(icon) will be removed from the status bar .and again it will be appeared depending up on condition .For this what can i do Give me some suggestions.Thanks in advance

    Read the article

  • SQL inner join from field defined table?

    - by Wolftousen
    I have a, currently, a total of 6 tables that are part of this question. The primary table, tableA, contains columns that all the entries in the other 5 tables have in common. The other 5 tables have columns which define the entry in tableA in more detail. For example: TableA ID|Name|Volumn|Weight|Description 0 |T1 |0.4 |0.1 |Random text 1 |R1 |5.3 |25 |Random text TableB ID|Color|Shape 0 |Blue |Sphere TableC ID|Direction|Velocity 1 |North |3.4 (column names are just examples don't take them for what they mean...) The ID field in Table A is unique to all other tables (i.e. TableB will have 0, but TableC will not, nor any other Tables). What I would like to do is select all the fields from TableA and the corresponding (according to ID field) detail Table (TableB-F). What I have currently done and not tested is added a field to TableA so it looks like this: TableA ID|Name|Volumn|Weight|Description|Table 0 |T1 |0.4 |0.1 |Random text|TableB 1 |R1 |5.3 |25 |Random text|TableC I have a few questions about this: 1.Is it proper to do such a thing to TableA, as foreign keys wont work in this situation since they all need to link to different tables? 2.If this is proper, would the SQL query look like this (ID would be input by the user)? SELECT * FROM TableA AS a INNER JOIN a.Table AS t ON a.ID = ID; 3.Is there a better way to do this? Thanks for the help.

    Read the article

  • Creating multiple objects of a view defined in the xml

    - by user362953
    I have to dynamically add a list of views (the views use RelativeLayout). Can I do this by specifying the view definition in xml and instantiate multiple objects off it? This gives the usual benefits of separating the view part from the code (for e.g., making it easy for the UI guys to alter things) or Is going the ArrayAdapter the suggested/only route?

    Read the article

  • Second user-defined function returns garbage value?

    - by mintyfresh
    I have been teaching myself C programming, and I've come to a difficult point with using variables across functions. When, I compile this program and run it, the function askBirthYear returns the correct value, but sayAgeInYears returns either 0 or a garbage value. I believe it has something to do with how I used the variable birthYear, but I'm stumped on how to fix the issue. Here is the code: #include <stdio.h> #include <stdlib.h> int askBirthYear(int); void sayAgeInYears(int); int birthYear; int main(void) { askBirthYear(birthYear); sayAgeInYears(birthYear); return EXIT_SUCCESS; } void askBirthYear(int birthYear) { printf("Hello! In what year were you born?\n"); scanf("%d", &birthYear); printf("Your birth year is %d.\n", birthYear); return birthYear; } void sayAgeInYears(int birthYear) { int age; age = 2012 - birthYear; printf("You are %d years old.\n", age); }

    Read the article

  • Using a method defined in appliciaton_controller.rb in application_controller.rb

    - by E.E.33
    I want to change my layout based on whether or not the current user is an admin. So I made a simple method to check if current user is admin, I then call that method in application controller. I keep getting the following error: undefined method `is_admin?' for ApplicationController:Class My code looks like this: class ApplicationController < ActionController::Base protect_from_forgery helper_method :current_user, :is_admin? if is_admin? layout 'admin' end ..... protected ..... def is_admin? if current_user.user_role == 'admin' return true end end end How should I be doing this? Thanks

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >