attributes

Add attribute to embed tag using jquery

I have the following embed tag: <embed type="application/x-shockwave-flash" width="640" height="505" src="url_to_video" allowscriptaccess="always" allowfullscreen="true"></embed> I have about five of theses on a page, and I'd like to add the attribute wmode="opaque" to all of them. However, I tried to do it like this and it didnt' wor...

WPF toolkit DataGrid show fields even with browsable attribute set to false

Hi Hi have an observable collection that I bind to a DataGrid using the itemsource property of the DataGrid. All the properties of the class inside the collection are displayed properly in the DataGrid. Now, I want to hide some fields to the DataGrid using the browsable attribute [Browsable(false)] in the class. It works well in winfor...

Workaround for abstract attributes in Java

In Scala I would write an abstract class with an abstract attribute path: abstract class Base { val path: String } class Sub extends Base { override val path = "/demo/" } Java doesn't know abstract attributes and I wonder what would be the best way to work around this limitation. My ideas: a) constructor parameter abs...

jQuery's attr - return multiple classes not just the 1st.

Given a div such as: <div class="widget block dock clock">yada yada</div> I'd like to be abe to use JQUERY's $(div).attr('class'); to find all the classes, but the JQUERY.attr only return widget. Is there a way with JQUERY to return all the classes defined for the element? Thanks ...

How and why is ObsoleteAttribute disallowed for property accessors?

Consider this scenario: public class C { private int _foo; public int Foo { get { return _foo; } [Obsolete("Modifying Foo through the setter may corrupt hash tables. " + "Consider using the method 'ModifyFoo' instead.")] set { _foo = value; } } public C ModifyFoo( int foo ) ...

Set attribute disabled to options NOT containing a certain string

I know this should be easier if I could only use optgroups. But I am trying to avoid hacking core of my CMS, so jQuery should come to rescue again, hopefully. I have a select with options in a hierarchy sometimes, and I want to put attributes disabled to any of options containing text NOT starting with a dash. I want to code like: Set...

how do i get change to div id to wait until next image is loaded

I am building a website where I need to change the div class that contains image in order to manipulate the style of the next image given it is different in size and needs to be handled differently. I have a manual slideshow system working with an array of images and an array of corresponding class names. The problem is that the javasc...

python create object and add attributes to it

Hi, I want to create a dynamic object (inside another object) in python and then add attributes to it. I tried: obj = someobject obj.a = object() setattr(obj.a, 'somefield', 'somevalue') but this didn't work. Any ideas? edit: I am setting the attributes from a for loop which loops through a list of values. e.g. params = ['attr1'...

Using variables within Attributes in C#

We have some Well-Attributed DB code, like so: [Display(Name = "Phone Number")] public string Phone { get; set; } Since it is quite generic we'd like to use it again, but with a different string in the Name part of the attribute. Since it's an attribute it seems to want things to be const, so we tried: const string AddressType =...

Send objects with custom attributes via a wcf service.

I just began studying WCF because i need it for a school assignment. But i have a problem when i am trying to send an object with some custom attributes. The object is: [DataContract] public class Person { [DataMember] [Searchable("ID")] public virtual String ID { get; set; } [DataMember] [Se...

How would I use reflection to call all the methods that has a certain custom attribute?

I have a class with a bunch of methods. some of these methods are marked by a custom attribute. I would like to call all these methods at once. How would I go about using reflection to find a list of all the methods in that class that contains this attribute? ...

How do I create a sliding drawer in code?

I'm trying to create a sliding drawer in code, but I don't understand what to do for the AttributeSet part of the constructor. What do I need to do for that? Also, how do I define in code where the slider is going to show up? Thanks, ...

Accessing methods of an object put inside a class

Hello, A class A possesses an instance c of a class C. Another class B has to modify c through C::setBlah(); method. Is it bad to create an accessor C getC(); in A and then use A.getC().setBlah() ? Or should I create a method A::setBlah(); that would call C::setBlah(); ? Isn't it annoying if there are several methods like that ? ...

Compound dictionary keys

I have a particular case where using compound dictionary keys would make a task easier. I have a working solution, but feel it is inelegant. How would you do it? context = { 'database': { 'port': 9990, 'users': ['number2', 'dr_evil'] }, 'admins': ['[email protected]', '[email protected]'], 'domain....

DI: Injecting ActionFilterAttribute implementation (ASP.NET MVC)

I was wondering if it is possible to inject a particular ActionFilterAttribute implementation using a IoC container. For example, imagine you create a TransactionAttribute class [Transaction] You use this to decorate action which should be wrapped in a transaction in the persistence layer. But implementation details of the attribute w...

C#: Making sure parameter has attribute

I have an attribute lets call it SomeAttribute and a class i need to make sure the class is passed a type which has SomeAttribute. So this is how i do it now: public class Test() { public Test(SomeType obj) { if(!obj.GetType().IsDefined(typeof(SomeAttribute), false)) { throw new ArgumentException("Err...

Keyup attribute 'name' change not working

Hey guys, I've got what I imagine is a simple question, but for some reason, I can't get it working right. Expected Behavior: I type characters into a field, and, through a function, those characters are translated into the value of the name HTML attribute. Actual Behavior: Reflected in Firebug, the value doesn't change or update. Th...

Fast ArgumentNullException with attributes. It is possible?

Hi. Is there any fast way to verify null arguments via attributes or something? Convert this: public void Method(type arg1,type arg2,type arg3) { if (arg1== null) throw new ArgumentNullException("arg1"); if (arg2== null) throw new ArgumentNullException("arg2"); if (arg3== null) throw new ArgumentNullException("arg3"); ...

select attribute mysql

I have there mysql table: **product (id,name)** 1 Samsung 2 Toshiba 3 Sony **attribute (id,name,parentid)** 1 Size 0 2 19" 1 3 17" 1 4 15" 1 5 Color 0 6 White 5 7 Black 5 8 Price 0 9 <$100 8 10 $100-$300 8 11 >$300 8 **attribute2product (id,productid,attributeid)** 1 1 2 2 1 6 3 2 2 4 2 7 5 3 3 6 3 7 7 1 9 8 2 9 9 3 10 And listed...

Symfony getAttributeHolder in forms

I have a CampaignForm class. It has children Campaign1Form, Campaign2Form, .. CampaignNForm They have by default ref_campaign_type = unique_value_for_each_form_class; How can I get this value in parent class CampaignForm? My way is: $vars = sfContext::getInstance()->getUser()->getAttributeHolder()->get('storedValues', null, 'nsappid_a...