attributes

Add a class depending on the attribute in jquery

Hi all, I'm trying to add a class to some input elements depending on the type, so if it's type='text' iI want to add .txt class and if it's typt='button' I want to add .btn class. I tried some stuff but so luck, it adds .text to all of them: var text_type = $('#right input').attr('type'); if(text_type=='text'){ ...

Inheritance of Custom Attributes on Abstract Properties

I've got a custom attribute that I want to apply to my base abstract class so that I can skip elements that don't need to be viewed by the user when displaying the item in HTML. It seems that the properties overriding the base class are not inheriting the attributes. Does overriding base properties (abstract or virtual) blow away att...

validation properties by attribute

I create class with two property - name,link(below). I use simple property validation by Required and StringLength attribute. I bind this class object to WPF ListBox(with textBoxs). But when I have textbox empty or write words longer than 8 sign nothing happens :/ What should I do to fires ErrorMessage? Or how to implement validation ...

XPath select an attribute based on value

Using VB.Net, I have an XmlNode object, xNode. I need to select an attribute of this node if it has a particular value. e.g. xNode.SelectSingleNode(".[@attr1='1']") I would expect this statement to return the attribute "attr1", only if it has a value of "1". However, I get an error - Expression must evaluate to a node-set. When I tr...

How to disable original img title when using qtip

I am using jquery 1.4.2 and qtip-1.0.js in ie/7/6/8 whenever I hover over the image on which the tooltip is applied, I get the tooltip... but I also do get the original title... does not happen on the firefox though... Is there any option or setting specific to disable the img titl and just show the tooltip? my code looks like this $(...

How to access/use custom attribute in spring security based CAS client

I need send certain attributes(say, human readable user name) from server to client after a successful authentication. Server part was done. Now attribute was sent to client. From log, I can see: 2010-03-28 23:48:56,669 DEBUG Cas20ServiceTicketValidator:185 - Server response: [email protected] <cas:proxyGrantingT...

XStream parse attributes and values at the same time

Hi, I have the following XML <search ver="3.0"> <loc id="ARBA0009" type="1">Buenos Aires, Argentina</loc> <loc id="BRXX1283" type="1">Buenos Aires, Brazil</loc> <loc id="ARDF0127" type="1">Aeroparque Buenos Aires, Argentina</loc> <loc id="MXJO0669" type="1">Concepcion De Buenos Aires, Mexico</loc> <loc id="MXPA1785" ...

preg_match_all to parse an xml-like attribute string

I have a string like so: option_alpha="value" option_beta="some other value" option_gamma="X" ...etc. I'm using this to parse them into name & value pairs: preg_match_all("/([a-z0-9_]+)\s*=\s*[\"\'](.+?)[\"\']/is", $var_string, $matches) Which works fine, unless it encounters an empty attribute value: option_alpha="value" option_b...

php object : get value of attribute by computed name

hi simple question - How do I access an attribute of an object by name, if i compute the name at runtime? Ie. i loop over keys and want to get each value of the attributes "field_".$key In python there is getattribute(myobject, attrname) It works, of course, with eval("$val=$myobject->".$myattr.";"); but IMO this is ugly!! TIA fl...

.NET - Retrieve attribute from controller context?

I have a controller insert action: <AcceptVerbs(HttpVerbs.Post)> _ Function InsertObject(<Bind(Exclude:="Id")> <ModelBinder(GetType(CustomModelBinder))> ByVal object As SomeObject) As ActionResult End Function And i have a CustomModelBinder class with a BindModel implementation: Public Function BindModel( _ ByVal controllerContext A...

Combining multiple attributes in C#

Is there a functional difference between the following syntax... [Foo, Bar] public class Baz {} ...and this syntax? [Foo] [Bar] public class Baz {} Assuming each produces identical results when compiled, which is the preferred form? ...

Fluent-NHibernate - Component property attributes ignored by Convention

I have a component with a number of properties that have various attributes Normally when these attributes are added to a plain old domain object they are picked up by my custom AttributeConventions. For the Component properties they are not. Is there some extra wiring needed for these? e.g. public class Component { [Length(Max=...

adding validation annotators to model classes when using Linq-to-SQL

How should I add the following attrubute [Required(ErrorMessage="...")] to one of the model properties when my model classes are automatically generated. There is a solution here, but it seems to be working only on Entity Framework ...

Wondering why DisplayName attribute is ignored in LabelFor on an overridden property

Hi, today I got confused when doing a couple of <%=Html.LabelFor(m=>m.MyProperty)%> in ASP.NET MVC 2 and using the [DisplayName("Show this instead of MyProperty")] attribute from System.ComponentModel. As it turned out, when I put the attribute on an overridden property, LabelFor didn't seem to notice it. However, the [Required] attribu...

Is there a simple way to test if a Moose attribute is read-only?

I currently use a block eval to test that I've set an attribute as read-only. Is there a simpler way to do this? Example from working code: #Test that sample_for is ready only eval { $snp_obj->sample_for('t/sample_manifest2.txt');}; like($@, qr/read-only/xms, "'sample_for' is read-only"); UPDATE Thanks to friedo, Ether, and Robert P...

Export Core Data Entity as text files in Cocoa

Hello, I have an entity in core data that has 2 Attributes. One that is a string called "name", and another one that is a string called "message". I need a method to create text files for all the attributes that the user has added. I wan't the files names to be the name attribute and the contents to be the message attribute. If anyone ...

How can I filter using the current value of a text box in a jQuery selector?

I have a validation script that checks for data-* attributes to determine which fields are required. If an element has the 'data-required-if' attribute (which has a jQuery selector as it's value), it checks to see if any elements are found that match that selector. If any are found, the field is required. It does something similar to the...

XSLT: attribute value used as numeric predicate

Given <xsl:variable name="datePrecision" as="element()*"> <p>Year</p> <p>Month</p> <p>Day</p> <p>Time</p> <p>Timestamp</p> </xsl:variable> The expression $datePrecision[5] returns a nodeSet containing one text node with value "Timestamp", as expected. Later in a template, with a context element having an attribute @pr...

JQuery: showing elements with a particular title

I am trying to show only elements that have the title attribute passed to the function: var selectservice = function(serviceStr) { $j("li.project").hide(); $j("li.project.attr('title').contains(serviceStr)").show(); }; I am not quite sure how to compare the title attribute to the passed string serviceStr? contains doesnt seem ...

StructureMap with my own attributes in C#

Hi All, I have an attribute that I have written that has a dependency on the Data Access Layer so I made a constructor that took the DAL class as a parameter (marked with [DefaultConstructor] and another, blank, constructor that is parameterless. When I call a method that depends on the attribute how do I make StructureMap inject the co...