Search Results

Search found 6519 results on 261 pages for 'nested attributes'.

Page 5/261 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • gcc returns error with nested class

    - by Nate
    Howdy, I am attempting to use the fully qualified name of my nested class as below, but the compiler is balking! template <class T> class Apple { //constructors, members, whatevers, etc... public: class Banana { public: Banana() { //etc... } //other constructors, members, etc... }; }; template <class K> class Carrot{ public: //etc... void problemFunction() { Apple<int>::Banana freshBanana = someVar.returnsABanana(); //line 85 giveMonkey(freshBanana); //line 86 } }; My issue is, the compiler says: Carrot.h:85: error: expected ';' before 'freshBanana' Carrot.h:86: error: 'freshBanana' was not declared in this scope I had thought that using the fully qualified name permitted me to access this nested class? It's probably going to smack me in the face, but what on earth am I not seeing here??

    Read the article

  • using nested arrays by php http_build_query() and recieve them in flash AS3

    - by Mahmoud
    hi, i am having this hard time figuring what is needed to do, i am using URLVariables to send/recieve values between flash and PHP the problem is, i am unable to access nested arrays ( array inside an array ) with flash heres an example: $dgresult = array("total" = $results); echo http_build_query($dgresult,"flf_"); in flash, all i need to do is to use: var variables:URLVariables = new URLVariables(e.target.data); then i can access it with : variables.total the problem now is when i have nested arrays: $dgresult = array("total" = $results); array_push($dgresult,$another_array); http_build_query($dgresult,"flf_"); i can still access variables.total but what about anything that has flf_ ? how is that possible?

    Read the article

  • Mysql SELECT nested query, very complicated?

    - by smartbear
    Okay, first following are my tables: Table house: id | items_id | 1 | 1,5,10,20 | Table items: id | room_name | refer 1 | kitchen | 3 5 | room1 | 10 Table kitchen: id | detail_name | refer 3 | spoon | 4 5 | fork | 10 Table spoon: id | name | color | price | quantity_available | 4 | spoon_a | white | 50 | 100 | 5 | spoon_b | black | 30 | 200 | How to do a nested select statement, where I want to select id, name, color, price and quantity_available column, from the each value inside the 'items_id' column in 'house' table? This is very challenging!! EDIT: after read robin's answer Table house: id | items_id | house1 | 1 | house1 | 5 | house1 | 10 | house2 | 20 | If this it the house table, how to do the nested, join, or whatever select statement??

    Read the article

  • AssociationTypeMismatch with Expected Type on Nested Model Forms

    - by Craig Walker
    I'm getting this exception when doing a nested model form: ActiveRecord::AssociationTypeMismatch in RecipesController#update Ingredient(#35624480) expected, got Ingredient(#34767560) The models involved are Recipe and Ingredient. Recipe has_many and accepts_nested_attributes_for :ingredients, which belongs_to :recipe. I get this exception when attempting to _destroy (=1) one of the preexisting Ingredients on a nested Ingredient form for the Recipe Edit/Update. This makes very little sense, mostly because the association types are as expected (by the exception's own admission). What makes even less sense is that it works just fine in a functional test. Any ideas what might be causing this, or what I should be looking for?

    Read the article

  • Nested form using accepts_nested_attributes_for with pre-population from another table

    - by mikeydelamonde
    I'm using Rails 2.3.5 and have a nested structure as follows: Lists has_many Items Items_Features has_many Features Items_Features has_many Items Items_Features has a text field to hold the value of the feature Then I have a nested form with partials to update and display this so that it updates Lists, Items and Items_Features What I want to do is generate input fields for each of the rows in features so that the user can fill in a value and it gets inserted/updated in items_features. I also want a label next to the box to display the feature name. It might look like this: List name: Cheeses Item1 name: Edam Feature, hardness: - fill in - <= this list of features from feature table Feature, smell: - fill in - How can I interrupt the nice and easy accepts_nested_attributes_for system to display this as I want?

    Read the article

  • T-SQL: Build Nested Set From Parent-Child Relationship

    - by Peder Rice
    I have a table that stores my Customer hierarchy with a nested set (due to the specific design of the application, I wasn't able to leverage just a Customer/Parent Customer mapping table). To simplify maintenance of this table, I've built a couple of stored procedures to handle moving nodes around and creating new nodes, but it's significantly more work than maintaining a Customer/Parent Customer table. Further, these structures are very fragile. So I'm looking for a way to have a Customer/Parent Customer table and then convert that table to a nested set on demand. Does anyone have a link to such an implementation?

    Read the article

  • Nested Set - for CMS with two versions (edit / publish) mode

    - by Rick
    Hi! I'm looking for a solution (PHP/Symfony/Doctrine) for the following problem. I'm creating a table called 'pages'. This table is a nested set. I also want to create a table called 'pages_published' which has ofcourse also a nested set. Once i create a record in table 'pages' at some point i want to publish this to the 'pages_published)-table. How do make sure the sort order and the level in the structure keeps ok. Is there some standard solution for my approach?

    Read the article

  • Modularity Java: top level vs. nested classes

    - by an00b
    The Java tutorials that I read, like to use nested classes to demonstrate a concept, a feature or use. This led me to initially implement a sample project I created just like that: Lots of nested classes in the main activity class. It works, but now I got a monstrous monolithic .java file. I find it somewhat inconvenient and I now intend to break to multiple .java files/classes. It occurred to me, however, that sometimes there may be reasons not to take classes out of their enclosing class. If so, what are good reasons to keep a module large, considering modularity and ease of maintenance?

    Read the article

  • Xcode debugger showing assembler for nested classes in a static library

    - by Massif
    I have a project A which creates a static library. I have a project B which uses this library. When I am debugging project B, certain functions within project A will display assembler when stepped into or when a breakpoint set inside them is hit. In the debug navigator, the line containing the function is grey instead of black. The strange part is that other functions in the same source file have no problems displaying. The thing that all these functions seem to have in common is that they belong to nested classes. However, I'm not totally convinced that this is the issue since functions from other nested classes display correctly. Does anyone know the cause of this?

    Read the article

  • How to change password on RAR archive w/o modifying arch. files attributes (modified/created)?

    - by Larry78
    How do I change the password of an .RAR archive, without changing the date/time attributes of the files in the archive? Unfortunately you can't directly change the password of the archive with WinRAR, you have to extract the files, and then make a new archive with the new password. So the created/modified attributes of the files in the archive get changed. I know you can manually change the attributes of a file with available utilities - but there are hundreds of files in the archive, each with unique attributes, so it would take a very long time to "fix" each file before re-archiving it. I'm using WinRAR 3.51, the last free version. Windows XP Pro SP3. Update: I don't care if the output is a .RAR file or a ZIP file IZArc4.1 will convert the RAR to a ZIP, and it keeps the dates. The problem is it compresses the file - there isn't a "store" option, and setting the default to store in the main configuration doesn't effect conversions. The RAR contains uncompressed files. None of these other archiving programs will even do a conversion. A couple claim to, or try to, but the errors returned indicate a very lousy application. So far I've tried PeaZip, 7-Zip, FilZip, TugZip, SimplyZipSE, QuickZip, and WinShrink (from downloads.cnet.com). WinRAR gives the error "skipping encryped archive" when I try the conversion. It asks for the password first, and I know it's right, as I opened the archive, and I can read/view all the files in it. It works on non-encrypted files.

    Read the article

  • XStream parse attributes and values at the same time

    - by gurbieta
    Hi, I have the following XML <search ver="3.0"> <loc id="ARBA0009" type="1">Buenos Aires, Argentina</loc> <loc id="BRXX1283" type="1">Buenos Aires, Brazil</loc> <loc id="ARDF0127" type="1">Aeroparque Buenos Aires, Argentina</loc> <loc id="MXJO0669" type="1">Concepcion De Buenos Aires, Mexico</loc> <loc id="MXPA1785" type="1">San Nicolas De Buenos Aires, Mexico</loc> <loc id="ARBA0005" type="1">Balcarce, Argentina</loc> <loc id="ARBA0008" type="1">Bragado, Argentina</loc> <loc id="ARBA0010" type="1">Campana, Argentina</loc> <loc id="ARBA0016" type="1">Chascomus, Argentina</loc> <loc id="ARBA0019" type="1">Chivilcoy, Argentina</loc> </search> And a City class public class City { private String id; private Integer type; private String name; // getters & setters... } I tried the following aliases to parse the XML xStream.alias("search", List.class); xStream.alias("loc", City.class); xStream.useAttributeFor("id", String.class); xStream.useAttributeFor("type", Integer.class); But I can't figure out how to set the value of the "loc" tag, if I try to transform the City object in XML I get <search> <loc id="ARBA0001" type="1"> <name>Buenos Aires</name> </loc> </search> When I really need to get this <search> <loc id="ARBA0001" type="1">Buenos Aires</loc> </search> Then, if I try to parse the XML to a City object I get the field "name" with a null value. Anybody knows how to set te correct aliases to do this? Thanks in advance.

    Read the article

  • Xpath that evaluates -all- attributes?

    - by Tres
    I maybe be trying to do something invalid here, but maybe someone smarter than me knows the correct syntax to solve my problem. Given: <group code="vehicle"> <line code="car"> <cell> <box code="price">1000.00</box> </cell> </line> <line code="car"> <cell code="sports"> <box code="price">500.00</box> </cell> </line> </group> If I use //*[@code="vehicle"]//*[@code="car"]//*[@code="price"], I will get both boxes returned (1000.00 and 500.00)--as expected but not what I want. Is there an xpath syntax that will evaluate against all nodes that have an attribute of @code rather than skipping it if it doesn't match with the end result being that I only get back the first box (price of 1000.00)? Like asking, choose the first node with @code and that @code must equal "vehicle", then choose the next node with @code and that @code must equal "car", then choose the next node with @code and @code must equal "price".

    Read the article

  • Reflection, get DataAnnotation attributes from buddy class.

    - by Feryt
    Hi. I need to check if property has specific attribute defined in its buddy class: [MetadataType(typeof(Metadata))] public sealed partial class Address { private sealed class Metadata { [Required] public string Address1 { get; set; } [Required] public string Zip { get; set; } } } How to check what properties has defined Required attribute? Thank you.

    Read the article

  • nested attributes with polymorphic has_one model

    - by Millisami
    I am using accepts_nested_attributes_for with the has_one polymorphic model in rails 2.3.5 Following are the models and its associations: class Address < ActiveRecord::Base attr_accessible :city, :address1, :address2 belongs_to :addressable, :polymorphic => true validates_presence_of :address1, :address2, :city end class Vendor < ActiveRecord::Base attr_accessible :name, :address_attributes has_one :address, :as => :addressable, :dependent => :destroy accepts_nested_attributes_for :address end This is the view: - form_for @vendor do |f| = f.error_messages %p = f.label :name %br = f.text_field :name - f.fields_for :address_attributes do |address| = render "shared/address_fields", :f => address %p = f.submit "Create" This is the partial shared/address_fields.html.haml %p = f.label :city %br= f.text_field :city %span City/Town name like Dharan, Butwal, Kathmandu, .. %p = f.label :address1 %br= f.text_field :address1 %span City Street name like Lazimpat, New Road, .. %p = f.label :address2 %br= f.text_field :address2 %span Tole, Marg, Chowk name like Pokhrel Tole, Shanti Marg, Pako, .. And this is the controller: class VendorsController < ApplicationController def new @vendor = Vendor.new end def create @vendor = Vendor.new(params[:vendor]) if @vendor.save flash[:notice] = "Vendor created successfully!" redirect_to @vendor else render :action => 'new' end end end The problem is when I fill in all the fileds, the record gets save on both tables as expected. But when I just the name and city or address1 filed, the validation works, error message shown, but the value I put in the city or address1, is not persisted or not displayed inside the address form fields? This is the same case with edit action too. Though the record is saved, the address doesn't show up on the edit form. Only the name of the Client model is shown. Actually, when I look at the log, the address model SQL is not queried even at all.

    Read the article

  • IDE underlining custom attributes

    - by runrunraygun
    I have a custom attribute... [System.AttributeUsage(System.AttributeTargets.All)] public class Refactor : System.Attribute { private string _message; public Refactor() { _message = string.Empty; } public Refactor(string message) { _message = message; } } Applied to [Refactor("this should be less rubbish")] public virtual void RubbishMethod() { … } Now when someone makes a call to RubbishMethod I'd like the IDE (vs2008) to underline that call in a deep brown colour, similar to if I mark as Obsolete you get a green wave line. Is this possible? I've been racking my brain and hitting the google but I can't find how and where to do this.

    Read the article

  • Setting attributes of a class during construction from **kwargs

    - by Carson Myers
    Python noob here, Currently I'm working with SQLAlchemy, and I have this: from __init__ import Base from sqlalchemy.schema import Column, ForeignKey from sqlalchemy.types import Integer, String from sqlalchemy.orm import relationship class User(Base): __tablename__ = "users" id = Column(Integer, primary_key=True) username = Column(String, unique=True) email = Column(String) password = Column(String) salt = Column(String) openids = relationship("OpenID", backref="users") User.__table__.create(checkfirst=True) #snip definition of OpenID class def create(**kwargs): user = User() if "username" in kwargs.keys(): user.username = kwargs['username'] if "email" in kwargs.keys(): user.username = kwargs['email'] if "password" in kwargs.keys(): user.password = kwargs['password'] return user This is in /db/users.py, so it would be used like: from db import users new_user = users.create(username="Carson", password="1234") new_user.email = "[email protected]" users.add(new_user) #this function obviously not defined yet but the code in create() is a little stupid, and I'm wondering if there's a better way to do it that doesn't require an if ladder, and that will fail if any keys are added that aren't in the User object already. Like: for attribute in kwargs.keys(): if attribute in User: user.__attribute__[attribute] = kwargs[attribute] else: raise Exception("blah") that way I could put this in its own function (unless one hopefully already exists?) So I wouldn't have to do the if ladder again and again, and so I could change the table structure without modifying this code. Any suggestions?

    Read the article

  • Copy constructor using private attributes

    - by Pedro Magueija
    Hello all, My first question here so be gentle. I would like arguments for the following code: public class Example { private String name; private int age; ... // copy constructor here public Example(Example e) { this.name = e.name; // accessing a private attribute of an instance this.age = e.age; } ... } I believe this breaks the modularity of the instance passed to the copy construct. This is what I believe to be correct: public class Example { private String name; private int age; ... // copy constructor here public Example(Example e) { this.setName(e.getName()); this.setAge(e.getAge()); } ... } A friend has exposed a valid point of view, saying that in the copy construct we should create the object as fast as possible. And adding getter/setter methods would result in unnecessary overhead. I stand on a crossroad. Can you shed some light?

    Read the article

  • Initialize virtual attributes

    - by Horace Loeb
    I have an IncomingEmail model with an attachments virtual attribute: class IncomingEmail < ActiveRecord::Base attr_accessor :attachments end I want the attachments virtual attribute to be initialized to [] rather than nil so that I can do: >> i = IncomingEmail.new => #<IncomingEmail id: nil,...) >> i.attachments << "whatever" Without first setting i.attachments to [] (put another way, I want this virtual attribute to default to an empty array rather than nil)

    Read the article

  • J2EE: Default values for custom tag attributes

    - by Nick
    So according to Sun's J2EE documentation (http://docs.sun.com/app/docs/doc/819-3669/bnani?l=en&a=view), "If a tag attribute is not required, a tag handler should provide a default value." My question is how in the hell do I define a default value as per the documentation's description. Here's the code: <%@ attribute name="visible" required="false" type="java.lang.Boolean" %> <c:if test="${visible}"> My Tag Contents Here </c:if> Obviously, this tag won't compile because it's lacking the tag directive and the core library import. My point is that I want the "visible" property to default to TRUE. The "tag attribute is not required," so the "tag handler should provide a default value." I want to provide a default value, so what am I missing? Any help is greatly appreciated.

    Read the article

  • Rails Nested Attributes, Relationship for Shared or Common Object

    - by SooDesuNe
    This has to be a common problem, so I'm surprised that Google didn't turn up more answers. I'm working on a rails app that has several different kinds of entities, those entities by need a relation to a different entity. For example: Address: a Model that stores the details of a street address (this is my shared entity) PersonContact: a Model that includes things like home phone, cell phone and email address. This model needs to have an address associated with it DogContact: Obviously, if you want to contact a dog, you have to go to where it lives. So, PersonContact and DogContact should have foreign keys to Address. Even, though they are really the "owning" object of Address. This would be fine, except that accepts_nested_attributes_for is counting on the foreign key being in Address to work correctly. What's the correct strategy to keep the foreign key in Address, but have PersonContact and DogContact be the owning objects?

    Read the article

  • Custom Attributes in Android

    - by Arun
    I'm trying to create a custom attribute called Tag for all editable elements. I added the following to attrs.xml <declare-styleable name="Spinner"> <attr name="tag" format="string" /> </declare-styleable> <declare-styleable name="EditText"> <attr name="tag" format="string" /> </declare-styleable> I get an error saying "Attribute tag has already been defined" for the EditText. Is it not possible to create a custom attribute of the same name on different elements?

    Read the article

  • What is the difference between declaring data attributes inside or outside __init__

    - by user1898540
    I'm trying to get my head around OOP in Python and I'm a bit confused when it comes to declare variables within a class. Should I declare them inside of the __init__ procedure or outside it? What's the difference? The following code works just fine: # Declaring variables within __init__ class MyClass: def __init__(self): country = "" city = "" def information(self): print "Hi! I'm from %s, (%s)"%(self.city,self.country) me = MyClass() me.country = "Spain" me.city = "Barcelona" me.information() But declaring the variables outside of the __init procedure also works: # Declaring variables outside of __init__ class MyClass: country = "" city = "" def information(self): print "Hi! I'm from %s, (%s)"%(self.city,self.country) me = MyClass() me.country = "Spain" me.city = "Barcelona" me.information()

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >