attributes

how do I get the class/property/etc associated with a .NET attribute?

If I apply a custom attribute to a class, for example: [Foo] class Bar {} It's clear that when I retrieve my Foo attribute instance, that it's associated with a Bar. Inside the Foo implementation, say in the ctor, how do I get the class associated with the instance of the attribute? So far, all I've been able to come up with is puttin...

Programmatically add an attribute to a method or parameter

I can use TypeDescriptor.AddAttributes to add an attribute to a type in runtime. How do I do the same for a method and parameter? (maybe 2 separate questions...) ...

RegEx to extract all HTML tag attributes including inline JavaScript

I found this useful regex code here while looking to parse HTML tag attributes: (\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']? It works great, but it's missing one key element that I need. Some attributes are event triggers that have inline Javascript code in them like this: onclick="doSomething(this, 'foo', 'bar');return false;...

Python instances and attributes: is this a bug or i got it totally wrong?

Suppose you have something like this: class intlist: def __init__(self,l = []): self.l = l def add(self,a): self.l.append(a) def appender(a): obj = intlist() obj.add(a) print obj.l if __name__ == "__main__": for i in range(5): appender(i) ...

How set attribute to MVC2 user control type in declarative way

How can I set attribute to MVC2 user control defined in single file with content: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> I'm searching declarative solution. Something like this: <%[DefaultProperty("Items")]%> <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> Thanks. ...

Sorting multiple XML elements within a node, by attribute

I've tried several of the solutions that I've found here, but none seem to work on the model that I'm using. In my example XML, I'm trying to sort the mixed up chapters, into their proper sequence. Source XML: <?xml version="1.0" encoding="utf-8"?> <library> <book> <title>A Fascinating Tale</title> <chapt...

Set Attribute @ run time

I have a class with a property in it.I want to know if we can set the attribute such as XmlAttributeAttribute.AttributeName. Here the ElementName attribute is set at compile time,i want top know can we set @ run time. public class MyTestClass { [XmlElement(ElementName = "MyAttributeName")] public int MyAttribute { ...

jQuery not first selector found by attributeContains

Hello there, i have problem with selecting "not first selector" with using attributeContains jQuery('div[id*="abc"]:not(:first)').hide(); Thanks a lot for help ...

Custom Attribute on HTML Element

Possible Duplicates: Storing arbitrary info in HTML tags for JavaScript? What are the concrete risks of using custom HTML attributes? Custom attributes - Yay or nay? What are the drawbacks of adding a custom attribute on a standard HTML element? For example: <intput type="textbox" id="MyId" MyCustomeAttribute="MyData" /> B...

Copy constructor using private attributes

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;...

Best Practice: Access form elements by HTML id or name attribute?

As any seasoned JavaScript developer knows, there are many (too many) ways to do the same thing. For example, say you have a text field as follows: <form name="myForm"> <input type="text" name="foo" id="foo" /> There are many way to access this in JavaScript: [1] document.forms[0].elements[0]; [2] document.myForm.foo; [3] d...

change a frame's attribute by pressing a button

Suppose we have a JFrame named frame1 with a String attribute named credentials set inittially to null. I have a jButton named button1 attached to the frame and I want to change the frame1 String credentials attribute by pressing button1. I need some piece of advice regarding the ActionListener code especially. ...

NSString sizeWithAttributes: Inaccuracy

I want to know the width of an NSString displayed on the screen in pixels. So I can fit an NSTextField its bounds to be exactly the length of the string itself. So I used IB's "Label" NSTextField and for those who don't know what I mean, I got a label with title "Label", font "Lucida Grande 13px", not selectable, not editable, regular si...

How do I add my own custom attributes to existing built-in Python types? Like a string?

I want to do something like this... def helloWorld(): print "Hello world!" string.helloWorld = helloWorld "foo".helloWorld() Which would print out "Hello world!" ...

The "Update" button in ArcFM Attribute Editor is disabled.

I am not been able to update any of the attributes in one of my feature classes using the Arc FM Attribute editor, but I am able to update it thru the ESRI Attribute editor. Please lemme know if somebody knows the reason. I am using Arc SDE 9.3.1 with ArcFM 9.3 and ArcMap 9.3 Note:I am in selection Tab and not in Target tab. Please...

Can you omit the parenthesis from attributes with no params?

I noticed when I have Serializable instead of Serializable(), the code still compiles. Is there a rule for this that you can omit the parenthesis? Is it a good practice? It seems more readable to me unless I am missing something. ...

Why are there magic attributes exposed in the Servlet spec?

It's always seemed a little at odds with the principles of Java that the Java Servlet Spec (2.5 version here) includes a set of magic attributes containing info about included resources, namely: javax.servlet.include.request_uri javax.servlet.include.context_path javax.servlet.include.servlet_path javax.servlet.include.path_info javax.s...

Is the "data" attribute a standard attribute of the XHTML Strict Doctype?

Can't find this info ... looks like its HTML-5ish ...

Why should I prepend my custom attributes with "data-"?

So any custom data attribute that I use should start with "data-": <li class="user" data-name="John Resig" data-city="Boston" data-lang="js" data-food="Bacon"> <b>John says:</b> <span>Hello, how are you?</span> </li> Will anything bad happen if I just ignore this? I.e.: <li class="user" name="John Resig" city="Boston" lan...

In DOM is it OK to use .notation for getting/setting attributes?

Hi In DOM, is it OK to refer to an element's attributes like this: var universe = document.getElementById('universe'); universe.origin = 'big_bang'; universe.creator = null; universe.style.deterministic = true; ? My deep respect for objects and their privacy, and my sense that things might go terribly wrong if I am not careful,...