attributes

Is it possible to use attributes in unmanaged code?

I have an unmanaged C++ application (unmanaged meaning: not using anything of the the fancy .Net stuff). I want to extend it with some meta information, and it looks like I could use the concept of attributes. What I actually try to achieve is the following. Starting from something a simple class like this: class Book { public: ...

C# Override an attribute in a subclass

public class MyWebControl { [ExternallyVisible] public string StyleString {get;set;} } public class SmarterWebControl : MyWebControl { [ExternallyVisible] public string CssName{get;set;} new public string StyleString {get;set;} //Doesn't work } Is it possible to remove the attribute in the subclass? I do want ...

jQuery .attr() and value

I want to make the following use .attr(); selectbox.options[selectbox.selectedIndex].value sadly, selectbox.options[selectbox.selectedIndex].attr("value") is not the same, and seems to defeat the purpose of the .attr altogether. My main question is: How should one use nested .attr()s? Muchos gracias mi amigos ...

changeFreq - new attribute for all (or at least most) HTML tags - is this a good idea? I'd like opinions before I take this further...

Hey, I have noticed, over the years, that sometimes search results will display results for pages where the content changes on pageload - for example if an online catalogue displays 5 random products in the "Featured Products" section. Some of the search results may be for these areas of the page. An idea I just came up with is that ea...

nested model form and update_attributes

hi, I have a nested-model form with a one-to-many relationship between a class Project and class TeamMember, and in the controller, an update function like : @project = Project.find(params[:id]) @project.update_attributes(params[:project]) Now, I'd like to set some fields that are not set in the form for some of the t...

How do I use update_attributes with custom setter methods in Rails?

I have a model called Contact with an attribute called phone_number. I have some custom setter methods such as def prefix=(num) self.phone_number[3..5] = num end When I call @contact.update_attributes({:prefix => '510'}), I don't get any errors and @contact gets changed, but the changes don't make their way to the database. I've tr...

How do you define an XML schema ID attribute that has a pattern??

This XML documentation seems to say that the ID derived type supports a pattern, but when I try to define one with this code: <complexType name="CourseType"> <attribute name="courseNumber" type="ID"> <pattern value="[A-Z]{2}(\d{3}).(\d{3})" /> </attribute> <attribute name="numOfCredits"...

Using html() as an attribute with jQuery

I am trying to select an element in the list depending on its html content. I was hoping to do something like $('li[html="something"]'), but of course html isn't an attribute. Is there an equivalent set based operation? I could of course iterate all the elements in the list using $.each(), but it seems to me it will be quite a lot slowe...

How to change specific text of mutiple classes

Hi there, I'm cloning a fieldset and incrementing the attribute names as a new clone is created. However I want the same to happen if I delete I clone so that any cloned fieldset after the deleted will fill in the gaps. As in, if the 2nd clone is deleted, the 3rd with be renamed as the 2nd etc. I'm trying to change a the classes and ID...

How to add an HTML attribute with jQuery

Well, I have this jQuery image slideshow that uses the attribute "control" inside an <a>. Seeing how it didn't validate I searched for a way to add this attribute inside my HMTL via jQuery but I didn't really find anything relevant. Now I don't really care about how valid my page is, but I'm really curious in how to add an HTML attribute...

How does one write HTML attributes over more than one line?

For those attributes that can stretch into infinity and beyond off-screen and do not tolerate white space like urls. Thanks. ...

How do you restrict a generic method to classes with a specified attribute?

I want to create a generic method that is only applicable to classes that have the Serializable attribute, e.g. public static int Foo<T>(T obj) where T : Serializable { ... } but obviously the above doesn't compile. And I'm guessing if I put SerializableAttribute there, it'll insist that T is an attribute, not a class with that att...

How can I pass a runtime method to a custom attribute or viable alternative approach.

Basically I would like to do something like this at the top of my class (I know this doesn't work as it isn't a constant).... [XmlStorage(IsSingleStorageFile = false, IsSubordinate = true, StorageLocation = "posts" + GetBlogId()] Where GetBlogId() would be a static utility method. I'm building an xml storage framework for a blogging ...

Magento: Difference between loading product through collection than product model

So we were trying to load a product through a collection with certain criteria, we didn't have the sku or the id so when we did the following $prodModel->getCollection() ->addAttributeToFilter('visibility', $visibility) ->addAttributeToSelect('*') ->addCategoryFilter($cat) ->addAttributeToFilter('attribu...

jQuery find attribute from url hash

Trying to find the attribute value from a url hash. // URL http://url.com/index.html#link // HTML <a href="#link" rel="3">Some link</a> // JS var anchor = window.location.hash.substring(1); // Need help finding attribute value from finding the anchor var attribute = .find('#+anchor').attr('rel'); //this needs to have a value of 3 Al...

Android UI: what kind of layout options are mutually exclusive?

After designing layouts in Android for a while now, I still cannot get the hang of it. Often the results are unpredictable. I think part of this boils down to some layout options not working well together. I.e. if you are using one way of specifying your layout, you're not meant to use some other way. Notably, for me, changing layout_...

jquery: hide title attribute but not remove it

Hi, I have seen that most people will do it with this solution that on mouse over, we will grab the value in the TITLE attribute, then, remove its value. While on mouse out, we'll put it back on. $(this).attr('title',''); or $(this).removeAttr('title'); I want to know is it possible just hide the tooltip from appearing than remo...

How to get image id using jQuery?

Hi there, I have written code like this. <img id='test_img' src='../../..' /> I want to get the id of this image on image load like, $(img).load(function() { // Here I want to get image id i.e. test_img }); Can you please help me? Thanks. ...

NUnit Category attribute equivalent in VSTS 2008 development edition

Hi, I am using VSTS 2008 development edition and I want to convert NUnit tests to MS tests. Currently some of the tests have "category" attribute of NUnit to control which tests to be run. I did some search and it looks like in VSTS 2008, we will need to create test list by Test Manager from VSTS Test edition. The question is how can ...

XSD restricting an xsd type while also allowing attributes

Hello everyone! I am new to XML and I am working on XSDs at the moment. I am supposed to validate an xml document that is based on credit cards. I have worked through most of the assignment, but I am stuck on declaring an element that must be a positive floating point number, while also allowing that element to have a required attribute...