attributes

Selenium RC: How to check if an element has a given attribute?

I have some buttons with an onclick attribute and some that don't. I want to check if the specified element has the onclick attribute. How can I do this? getAttribute() returns the attribute value when it has one. When it doesn't, it throws a RuntimeException and stops the test (even when I wrap it in a try/catch block). $onclickValue ...

DataAnnotations Automatic Handling of int is Causing a Roadblock

Summary: DataAnnotation's automatic handling of an "int?" is making me rethink using them at all. Maybe I'm missing something and an easy fix but I can't get DataAnnotations to cooperate. I have a public property with my own custom validation attribute: [MustBeNumeric(ErrorMessage = "Must be a number")] public int? Weight { get; set; }...

What is the pythonic way to setattr() for a module?

In a class method, I can add attributes using the built-in function: setattr(self, "var_name", value). If I want to do the same thing within a module, I can do something like: globals()["var_name"] = value Is this the best way to do this, or is there a more pythonic solution? ...

Core Data deleteObject: sets attributes to nil

I am implementing an undo/redo mechanism in my app. This works fine for lots of cases. However, I can't undo past deleteObject:. the object is correctly saved in the undo queue, and I get it back and reinsterted into the Core Data stack just fine when calling undo. The problem is that all it's attributes are getting set to nil when I...

Access value through parent attribute

I am looking to get the value A-1 through xpath based on a passed attribue. I have passed the index attribute of the unit through php from a previous page and am accessing it by global GET: $value = intval($_GET['index']); the xml: <UNIT index='1'> <ID>A-1</ID> <MANUFACTURER>testing inc.</MANUFACTURER> </UNIT> <UNIT inde...

ASP.NET MVC RequireHttps not available

I'm using System.Web.MVC v2.0.50727 and can't seem to apply the RequireHttpsAttribute. I can use [OutputCache(...)] for instance, but if I try to use [RequireHttps] I get a missing assembly error. Is there a later version of mvc 2 out there that includes this? ...

JQUERY: When I remove a attr, I can't add the attr again

This is my code: $("input[name=donationmode]").change(function() { $(".setpaymentOptions").children().addClass("fadeout"); $(".setpaymentOptions").children().children(".inputfield").children("input").attr("disabled", "disabled"); $(".option-"+$(this).val()).removeClass("fadeout"); $(".option-"+$(this).val()).children("....

jquery get attributes

I'm looking for a way to grab the custom attributes of a element with jquery. <span id='element' data-type='foo' data-sort='bar'></span> I'm looking to get: ["data-type", "data-sort"] as an array. Anyone know how to do this? Thanks. ...

Xpath that evaluates -all- attributes?

I maybe be trying to do something invalid here, but maybe someone smarter than me knows the correct syntax to solve my problem. Given: <group code="vehicle"> <line code="car"> <cell> <box code="price">1000.00</box> </cell> </line> <line code="car"> <cell code...

Using attributes to fulfill interface requirements

Ok, I'm on the verge of overthinking this. Is there a way to combine interfaces and attributes such that an attributed property in the implementing class fulfills the interface contract? In my app I'd like to show a list of activities, which is an aggregation of events in the system such as a new message, a new task being created/assig...

C++ Virtual Methods for Class-Specific Attributes or External Structure

I have a set of classes which are all derived from a common base class. I want to use these classes polymorphically. The interface defines a set of getter methods whose return values are constant across a given derived class, but vary from one derived class to another. e.g.: enum AVal { A_VAL_ONE, A_VAL_TWO, A_VAL_THREE }; enum B...

Can I use a attribute to make .net impersonate another user?

I am familiar with impersonating an account in .net by using: dim myIdentity as WindowsIdentity = someIdentity using ctx as WindowsImpersonationContext = myIdentity.Impersonate() doStuff() end using Is it possible to define a .net attribute so that I could write something like: < runAsUser(someIdentity) > public sub doStuff...

How can I stop XmlSerializer transforming &#234; to &amp;#234; in an attribute?

I have the following DOM <row> <link href="B&#252;ro.txt" target="_blank"> my link </link> </row> When I serialize it to a file using the Java XmlSerializer it comes out like this: <row> <link href="B&amp;#252;ro.txt" target="_blank"> my link </link> </row> Is ...

.NET XML Serialization, possibly to use a different method name than PropertySpecified for ignoring properties?

I have a bunch of classes that I intend to serialize in order to transport over a webservice call. These classes already have properties that return whether a given "real" property has a value or not, that is ingrained in a lot of code of our product. Is it possible, for instance through attributes, for me to specify that each "real" p...

How to get attribute value using SelectSingleNode?

I am parsing a xml document, I need find out the gid (an attribute) value (3810). Based on SelectSingleNode(). I found it is not easy to find the attribute name and it's value. Can I use this method or I must switch to other way. Attached my code. How can I use book obj to get the attribute value3810 for gid. Thank you. My test.xm...

Proper usage (best practices) of Browsable attribute in .NET for runtime grid component behavior

I understand how Browsable attribute is supposed to work. It's supposed to hide a property from showing up in a PropertyGrid in design time. It also has another effect in that it will stop a Property from showing up in components such as Grids, or specifically Infragistics WinGrid. I am not sure if it has this behaviour on regular Win...

JAXB Unable To Handle Attribute with Colon (:) in name?

I am attempting to use JAXB to unmarshall an XML files whose schema is defined by a DTD (ugh!). The external provider of the DTD has specified one of the element attributes as xml:lang: <!ATTLIST langSet id ID #IMPLIED xml:lang CDATA #REQUIRED > This comes into the xjc-generated class (standard generation; no *.xjb magic) as: @XmlAt...

Python: Preserve file attributes in ZipFile

Hello. I'm looking for a way to preserve the file attributes (eg. read-only) of a file that gets written to a zipfile.ZipFile instance. The files I add to the zip archive gets their file attributes reset, eg. the read-only flag is gone when inspecting the archive with zip applications and after unzip. My current environment is Windows...

XPath: How to check multiple attributes across similar nodes

Hi, If I have some xml like: <root> <customers> <customer firstname="Joe" lastname="Bloggs" description="Member of the Bloggs family"/> <customer firstname="Joe" lastname="Soap" description="Member of the Soap family"/> <customer firstname="Fred" lastname="Bloggs" description="Member of the Bloggs family"...

Magento: Attribute always returns default value in catalog view, works fine in product view

I've created a new Yes/No attribute for products. I've extended the Product model to do some custom logic and the custom functions are working everywhere. When I initially tried getting the custom attribute value, I ran into some issue. Magento wasn't loading it for me, so calls to $product->getMyAttributeName() did nothing. In the p...