attributes

Can I define properties in partial classes, then mark them with attributes in another partial class?

Is there a way I can have a generated code file like so: public partial class A { public string a {get; set;} } and then in another file: public partial class A { [Attribute("etc")] public string a {get; set;} } So that I can have a class generated from the database and then use a non-generated file to mark it up? ...

Flex XML Tag Attribute Value / Property Parsing

I'll try to ask this in a way that makes some sense. I have an RSS feed, within Flex I have connected to the feed via HTTPService, the XML structure is as follows (not exact, but for the purpose of the question). I am able to walk down the xml and access the data within the title and link nodes with success but when I get the the descri...

"RequiredAsSet" validation attribute

I'm using the data annotations attributes for validation in my app, and I want to have a RequiredAsSet attribute, which will require either all properties decorated with the attribute to be populated, or none of them. The set cannot be part populated. I thought a clever way to do it would be like this: public class RequiredAsSetAttribu...

Inheritable attributes in ruby classes

Greets to all! I want to describe each kind of product by a class: # Base product class class BaseProduct prop :name, :price # Common properties for all inheritable products end class Cellphone < BaseProduct prop :imei # Concrete property for this product end class Auto < BaseProduct prop :max_speed, :color # Concrete properties...

How to specify &mdash; as an attribute value in JSF?

When I tried the next code: <o:weekSwitcher splitter="&mdash;"/> I received error "unresolved entity reference mdash". How can I work around this issue? ...

Can an attribute discover what method it is applied to at run time?

Is there a way for an attribute that has been applied to a method to know what method it was applied to at run time? [AttributeUsage(AttributeTargets.Method)] public class CustomAttribute : Attribute {} public class Foo { [Custom] public void Method() {} } Then I query the attribute at run time var attribute = typeof(Foo) ...

C# Attributes that figures out if another attribute is applied

I am working on a Asp.net MVC project and I am wondering if there is a way for the attributes to talk to other attributes. For example, I have the following attributes public class SuperLoggerAttribute : ActionFilterAttribute { public override void OnActionExecuted(ActionExecutedContext filterContext) { //Do something s...

AttributeError: 'NoneType' object has no attribute 'findSongBySize'

Hi - I'm new to Ubuntu (and the Python scripts that go with it) and I've been hitting this error with the iTunesToRhythm script. **Traceback (most recent call last): File "/home/amylee/iTunesToRhythm.py", line 220, in <module> main(sys.argv) File "/home/amylee/iTunesToRhythm.py", line 48, in main match = correlator.correlate...

hiding columns in datagridview (autogeneratedcolumns = true)

Hi, is there a attribute for properties which controls the autogenerate columns behavior from datagridview? By Browsable(false) the datagridview doesnt generate a column for the property (!) and i want that it generates a column but set the column to visible = false; thanks ...

Accessing properties of html element inside javascript function using $(this) gives undefined

I am calling a function test() on an anchor tag like this:- <a class="link" onclick="test();">Hello</a> And I am trying to access the class of the anchor inside the function test():- function test() { alert($(this).attr("class")); } But this alerts undefined. I know that calling onclick=test(this); instead and having the followin...

XSD Required One of Two Attributes?

Hey all, Quick question, i know i can choice elements, so one or the other is required, that's grand. Is it possible to do that with Attributes? Simple sample... <xs:element name="date" minOccurs="1" maxOccurs="unbounded"> <xs:complexType> <xs:choice> <xs:attribute name="monthid" type="id" use="optional" /> <xs:attri...

Attributes in .net

Possible Duplicate: When should I use attribute in C#? Hi, I am trying to understand how Attributes in .net works. As we all know Attributes are of two types metadata and context attributes. Metadata attributes: it allows some data to be attached to a class or method. This data becomes part of the metadata for the class, an...

What do other people think of using "custom" attributes to make things easier (in jQuery)...

Hey, I am currently jQuerifying (if there is such a word) my website. I am not good at JavaScript at all, and not great on jQuery. Object orientation is way passed me in JS, but the rest of my site is object oriented VB.net. I noticed, from some experience I had of jQuery a while back, just how difficult it can be when loading pages for...

in regards of finding all nodes that have an attribute that matches a certain value with scala

Hi, I saw the following example disccussed here previously, where the goal was to return all nodes that contain an attribute with an id of X that contains a value Y: //find all nodes with an attribute "class" that contains the value "test" val xml = XML.loadString( """<div> <span class="test">hello</span> <div class="test"><p>hel...

jquery attribute selector on collection

So if I were to do this $('.my_class[href]'), this should return to me all the elements in the page with class 'my_class' that has attribute 'href'. Could I get to the same result if I have a variable with the value $('.my_class')? How do I filter only those elements in that variable with those who have attributes? ...

Custom attribute in .NET to execute code before and after decorated method?

Ideally I'd like to find a way to do something like: [MyCustomAttribute()] public void MyMethod() { Debug.Write("B"); } public MyCustomAttribute : Attribute { public void OnBegin() { Debug.Write("A"); } public void OnEnd() { Debug.Write("C"); } } Which would write: ABC When MyMeth...

In which language did attributes first appear

It seems that almost all features in C# were borrowed from another languages (OOP from Java, generics (parametric polymorphism) and lambdas from ML family, LINQ from Haskell's monads and dynamic from dynamic languages), but I don't know the origin of attributes(annotations in Java world). Is C# the first language that introduced attribut...

ruby on rails custom setter help

Hello, sorry for my english, I have a model named Recipe and Recipe has an attribute named duration In my form, I have 2 dropdowns to get duration attribute select_tag 'duration[hours]' select_tag 'duration[minutes]' I need the value of duration attribute like this format hh:mm:ss I have tried with def duration=(d) self.duration...

Magento: Adding filterable attribute list to template file

I have a Men and Women store setup under the same website in Magento. The Men website runs off of the Men category and the Women site off of the Women category. I have a filterable custom attribute setup entitled 'designer'. Currently, the layered navigation on a category page shows the Designer attribute for the products in that store a...

Any substitute solutions of generic type attributes?

Becase we can't use generic type attributes, are there any substitute solutions? Maybe an example is helpful to discuss: public abstract class ErrorHandler { } public class AccessHandler : ErrorHandler { } public class ConnectionHandler : ErrorHandler { } public class OtherHandler : ErrorHandler { } public class CoHandler<T> : Attribut...