attributes

jQuery get img source attributes from list and push into array

I have this thumbnail list and would like push the image paths (sources) into an array: tn_array <ul id="thumbnails"> <li><img src="somepath/tn/004.jpg" alt="fourth caption" /></a></li> <li><img src="somepath/tn/005.jpg" alt="fifth caption" /></a></li> <li><img src="somepath/tn/006.jpg" alt="sixth caption" /></a></li> </ul> ...

jQuery - How do you store and access an object within another object

I am trying to store an object as an attribute in another object but can't seem to access it. Is it possible? <script language="javascript"> $(document).ready(function() { //create a TestObject function TestObject() { this.testProperty = "green"; } //and an instance of it var testObject = new TestObject()...

Why cant i set $_SERVER['DOCUMENT_ROOT'] as Attribute?

Why cant i set $_SERVER['DOCUMENT_ROOT'] as attribute? see example code class foo { private $path = $_SERVER['DOCUMENT_ROOT']; // generates error private $blah; public function __construct() { //code } public function setBla($bla) { $this->blah = $bla; } } ...

C# Buddy Classes / Meta Data and Reflection

I am trying to use reflection to check if properties on a given class have a ReadOnly attribute set. The classes I am using are MVC View Models (using a partial "buddy" class for the metadata. public partial class AccountViewModel { public virtual Int32 ID { get; set; } public virtual decimal Balance { get; set; } } [...

What's the difference between using the Serializable attribute & implementing ISerializable?

Hi folks, what's the difference between using the Serializable attribute and implementing the ISerializable interface? Please clarify. TIA ...

PHP, SimpleXML, how to access <tag> by its id attribue and now array position ?

Hi, I would like to understand how to access a by its id and not trough array position, example, I dont want to do this, $myXML->someNameHere[1]->home[0] I want to go access someNameHere by its ID "hi" Thanks a lot for your atention, ;D ...

Are there attributes that affect how the CLR optimizes during a JIT compile?

As the question says, I am curious if any of you know about attributes that affect how the CLR will compile/optimize the bytecode. Is there an attribute that will affect code inlining decisions? Unroll loops? Are there undocumented attributes on classes generated for anonymous types/delegates? There's probably attributes to disable op...

Is there a clean way to make CanExecute always return true with an attribute?

I think I already know the answer to my question, but I want to put it out there anyway. I have an app with a ton of command handlers, each with special logic in their CanExecute methods to enable the bound Buttons appropriately. Now I'm in a situation where I don't want any of the logic to execute, because execution results in calls t...

how to overcome "name" attribute error in xhtml Strict

in my form i have this code <form action="mail.php" class="contactForm" name="cform" method="post"> Problem is when i validate it tells me "name" is not allowed on xhtml strict. is there a way i can use soem thing else for this. thanks ...

PHP SimpleXML, how to set attributes ?

Hi, if you've got something like, <hello id="1" name="myName1"> <anotherTag title="Hello"> </anotherTag> </hello> <hello id="2" name="myName2"> <anotherTag title="Hi"> </anotherTag> </hello> How to change the attributes of, for example, hello id 2, to name="William" ? Or the title hi to hello ? Thanks a lot for your atention, H'...

How to set property value through an attribute tag name using reflection ?

I wish to write a reusable library for querying against AD with LDAP. I'm using both ActiveDs COM objects and System.DirectoryServices. Greatly inspired by Bart de Smet LINQ to AD, I have written a SchemaAttribute and an DirectoryAttributeAttribute classes to use with a DirectorySource(Of T) class (Yes, it's VBNET, but any C# code will ...

Recurse through properties of a class

Take this sample class as an example: [AttributeUsage(AttributeTargets.All, AllowMultiple=true)] public class BugFixAttribute : System.Attribute { public int BugId { get; private set; } public string Programmer { get; private set; } public DateTime Date { get; private set; } public string Comments { get; set; } ...

Applying an attribute to an interface using PostSharp

I want to be able to apply an attribute to an interface so that every method in any class that implements that interface will have the attribute applied to it. I assumed it would look something like this: [Serializable] [AttributeUsage(AttributeTargets.All, Inherited = true)] public sealed class TestAttribute : OnMethodBoundaryAspect {...

Get All of One (or More) Element's Attributes with jQuery

Hi All, I have a requirement to supply values from 2 select boxes to an Action Method. I'd like to know if there's a way to automatically extract all of the attributes from the selected options from each select box into a data object that I can pass to the server with my $.get? Ideally, I could use a function like this: http://plugin...

C# Attributes and attribute location/targets

I wonder if you can help me with this. I'm reading up about attributes and understand that they can be made to apply to different target entities with you code - (see Attribute Targets). So, looking at the AssemblyInfo.cs file in my project, I can see the following: [assembly: AssemblyTitle("AttributesDemo")] [assembly: AssemblyDescri...

Limiting a typeof() parameter on an attribute to specific types only...is this possible?

I'm using attribute-based validation, and I would like to limit what can be entered in theses attributes. ex: ThisValidatesSomethingAttribute(Type typeOfExceptionToThrowOnFailure) so on use it is [ThisValidatesSomething(typeof(MassiveFailureException))] public int SomeIntParameter() is there a way to limit the types that can be e...

Moq and parameter attribute inheritance

When I try to mock a class using Moq the method attribute gets inherited to the mock class, but not the parameter attribute. Basically the row "let a = (ArgumentsAttribute) p.GetCustomAttributes(typeof (ArgumentsAttribute), true).SingleOrDefault()" doesnt return the attribute.. Run the code to see where it fails. How do I make this tes...

What is the utility of the attribute GeneratedCodeAttribute in C #?

I generated some of my C# code with an external tool. Each generated class has an attribute GeneratedCodeAttribute. Why is my generator creating this attribute? ...

Attributes creating fields in C#

Alright, so after a few hours of me playing around to no avail, I built a model: [AttributeUsage(AttributeTargets.All)] public class PublicAttribute : System.Attribute { public enum Access { Public, Private } public PublicAttribute(string Name, Access acs) { } public PublicAttribute(string Name, Access acs, Action ge...

.NET custom property attribute?

EDIT: I'd better rephrase: How can I shift the GET-implementation of a Class property to a / using a custom attribute? (I've added instantation vars (classname, propertyname) to the attribute, however I'd rather have these automatically fetched ofcourse.) Public Class CustomClass <CustomAttributeClass(ClassName:="CustomClass", Prope...