attributes

Question about HTML elements and custom attributes

Possible Duplicate: Custom attributes - Yay or nay? Is it appropriate to create custom attributes for HTML elements as so: <input type='text' value='name' custom_attribute='value'> This seems a little hacky and I'm not sure if it is supported largely or exactly how it would be accessed via DOM. ...

Using Fluent-NHibernate with tables in different database schemas

I have a database that I'm running several applications from. I like to separate the tables by creating a schema for each application. For my newest application I'm using FluentNHibernate. Seems like I have most of the plumbing correct but when I try to query one of my tables it can not find my table. I ran query analyzer and saw the sch...

Why are positional and named parameters for attribute types limited to the attribute parameter types?

Why are positional and named parameters for attribute types limited to the attribute parameter types? Background: I'd like to supply functionality at runtime to an attribute. The only way I can see of doing so is to supply a System.Type which I then use to access the required functionality using something like Activator.CreateInstance w...

Attribue to verify field is initilized by a given point in an ASP.Net page lifecycle

I would like to create an attribute I can decorate specific fields or properties with. This attribute will throw an exception if the field or property it decorates is null at a given point in an ASP.Net page lifecycle. I.E. if a property, "x", is null at the prerender stage of an ASP.Net page, it will cause a "ArgumentNullException" exc...

When is the desctructor called for a custom attribute class?

Say I have this class: [AttributeUsage(AttributeTargets.Method)] public class MyAttribute : Attribute { public MyAttribute() { // Do stuff } ~MyAttribute() { // When is this called? When the function ends? Whenever the GC feels like? } } ...

setAttribute style not working in IE

Hello, Setting the style attribute to elements is not working in IE 6/7 . But in other browsers, it works well. The code i am using is var box_style = 'width: 200px; background:red'; document.getElementById('box').setAttribute("style", box_style); This works in all other browsers except IE 6/7 Am i doing anything wrong ? or is t...

Magento: How to show only products with a custom binary attribute

I created some custom attributes for my Products in the backend, put together in a single attribute set. Attributes are like: "Can be used to fill holes in teeth" "Can be used to to cover up fillings" "Is absorbable" All of those attributes are of the "yes/no" kind. I made all of them searchable, yet when I search for "fillings" or "...

jQuery rel attribute

We have many links with rel attributes: <div class="team-tags"> <a class="s1" rel="t1 t2 t3" href="#">One</a> <a class="s2" rel="t2 t3" href="#">Two</a> <a class="s3" rel="t1" href="#">Three</a> <a class="s4" rel="t4 t6" ref="#">Four</a> <a class="s5" rel="t2 t5" href="#">Five</a> </div> And one ul: <ul class="team"> <li class=...

Validating the attribute target from the attribute code

Need to verify that the attribute can be applied only to a class that implements a certain interface. Googled on that and couldn't find any way to access the type of the target class from the attribute code. Is there any easy way to do that, please? [optional] Is there a "portable" way (I mean, it would be totally great if the code wi...

XmlSerializer and nullable attributes

I have a class with numerous Nullable<T> properties which I want to be serializable to XML as attributes. This is apparently a no-no as they are considered 'complex types'. So, instead I implement the *Specified pattern, where I create an addition *Value and *Specified property as follows: [XmlIgnore] public int? Age { get { return...

RegEx: Validating Alternate text for image

Hi, I'm trying to set validation for an image alternate text, and here's what I think should be validated so far. It's a pretty simple RegEx, but I'm yet to start learning that topic.. Double quotes < and > characters to prevent HTML input Is there anything else you would add to this? Would text length ever be an issue? I apprecia...

Python string to attribute

Hello, How can I achieve such job: def get_foo(someobject, foostring): return someobject.foostring IE: if I do get_foo(obj, "name") it should be calling obj.name (see input as string but I call it as an attritube. Thanks ...

How to use ResourceExposureAttribute and ResourceConsumptionAttribute?

I have found the attribute ResourceExposureAttribute and ResourceConsumptionAttribute in the DefaultTraceListener. When are used? Are they read by the framework or should be considered by the programmer? More, what are the differences between them? ...

Why is this XML being output by this XSLT? I'm using the XslCompiledTransform....

Could someone tell me why this is happening, please? My XML is: <?xml version="1.0" encoding="utf-8" ?> <example xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XMLCompositeQuoteswithSelect.xsd"> <title>some text goes here</title> <atopelem>a top elem</atopelem> <date>today</date> <a...

<return: > attribute equivalent in Visual Basic.Net

I have a C# web method that I need to translate to VB.NET. The method has following attribute: [return: System.Xml.Serialization.XmlElement("MethodName", Namespace = "http://namespaceurl")] public CustomClass Method() .... The method returns custom class as result. How can I translate this to VB.NET? ...

Making a LazilyEvaluatedConstantProperty class in Python

There's a little thing I want to do in Python, similar to the built-in property, that I'm not sure how to do. I call this class LazilyEvaluatedConstantProperty. It is intended for properties that should be calculated only once and do not change, but they should be created lazily rather than on object creation, for performance. Here's t...

Unable to unset Read-only attribute of directory

Hi, I am facing a problem with directory attribute. I have a script that creates a sub-directory inside a given dir. For example, the script creates directory 'auto' inside G:\root\ The script then tries to MOVE a directory from a given location to G:\root\auto\ The problem is that when it tries to perform the MOVE operation, it get...

ASP.NET ActionFilters and inheritance.

All my controllers inherit from a BaseController that has an ActionFilter attribute: [AnalyticsData] public class BaseController : Controller {} public class AccountController : BaseController {} Some of my Actions in my controllers reuse the AnalyticsData ActionFilter: public class AccountController : BaseController { [Analytic...

How to "pass" class attribute to a class method?

How can I "pass" eventName to dbSafe() in the following fashion? Is this possible? What would dbSafe() look like? $eventClass->eventName->dbSafe(); I'm guessing dbSafe() would look roughly like this: public function dbSafe() { return mysql_real_escape_string($this); } ...

Magento: getting attributes from an attribute set without a product

I have set an attribute set in my Magento shop which has several binary attributes. For a pulldown I need a list of ALL the attributes inside this one attribute set, including their internal name and their label. Since this pulldown should appear in places that not necessarily have a product selected I can't go the usual route of "getti...