attributes

JavaScript/jQuery: How do I get an array of all attributes in an XML element?

Given an XML element in jQuery like so: $('<foo oy="vey" foo="bar" here="is" another="attribute" />') Can I use either jQuery or plain old JavaScript to get an array containing the names of all the attributes in an XML element? I would expect this: ['oy','foo','here','another'] ...

selecting textareas

Hi, I am trying to select specific element types in a row and change their attribute, specifically the id and name attributes. Using the following works fine for single line text input boxes: $('input:text', newRow).attr('id','os' + newRowNum ).attr('name','os' + newRowNum ); however, when I change the html to: <td><textarea name="o...

HTML element with double attribute

(The question below is hypothetical, but for reading convenience I'll ask as if I'm actually doing it) I'm building a site in HTML 5. Unfortunately, IE doesn't support HTML5 elements like "header" and "nav". I was hoping it would treat them like generic "div"'s, but it doesn't. It simply acts as if they aren't there (meaning no CSS is a...

Regex: Does an XPATH string point to an attribute?

Here's what I'm using: ".+/@[^/]+$". Can you think of a reason why this might not work? ...

Jquery: Get value from dynamic attribute

Hello, I’m adding a total amount value to a DIV through a jQuery Ajax call everytime I add a new item to a shopping cart. I need this value to be a part of a difference calculation (payment-totalAmount), but I’m having troubles getting the totalAmount value. I set the total amount in the function called SetTotalAmount and then I try to...

Get binded value from class property, DefaultBindingProperty is not working for me!

Hello, I'm creating some entities (class) for my project and I want to set a default binging property for it, here is an example namespace MyNamespace { [System.ComponentModel.DefaultBindingProperty("Name")] public class Person { public int ID { get; set; } public string Name { get; set; } public int ...

Constant Values Required in Variable Declartion

We are using a custom API in our project which provide an attribute for class fields/members which lets the interface to present a popup of some range values like "On/OFF" and pass the corresponding values of the choice to our code. The attribute requires a string array to know that values. We have many enumerations defined for these ra...

Possibility of Implementing Minimize-to-Tray in C# in an Attribute

Attributes are awesome. But is it possible to create a C# attribute class that, when tagged, makes your application minimize to the system tray? Technically, the attribute would need to be placed on the class of the main form. Once the user clicks on the X button, that form shouldn't terminate, but should minimize to the taskbar. The ic...

how to model mutually exclusive attributes in UML?

I'm working up an analysis model in UML, and I'm a bit stuck when trying to represent a constraint on a couple of attributes in a class diagram. In the following class: +-----------+ | SomeClass | +-----------+ | isFoo | | isBar | | isBaz | | isQuux | +-----------+ all the listed attributes are Boolean types, and the f...

Rails creating users, roles, and projects

I am still fairly new to rails and activerecord, so please excuse any oversights. I have 3 models that I'm trying to tie together (and a 4th to actually do the tying) to create a permission scheme using user-defined roles. class User < ActiveRecord::Base has_many :user_projects has_many :projects, :through => :user_projects has_m...

XPath: what can be selected?

Am I correct in thinking an XPath expression can only point to/select either an element or an element attribute? ...

How to set custom attribute that is only valid on return int value function

I know AttributeUsage class. This class can set only property or method or class ...etc I need custom attribute that is only acitve on method and method must return int value. If any function return string value, this attribute will don't work. Only work on int value. Is there any like this attribute? How can i create? Is it possible...

Can an attribute's target be derived from an instance of the attribute?

Example: [AttributeUsage(AttributeTargets.Class)] public class MyAttribute : Attribute { public MyAttribute() { Console.WriteLine("I was defined on the {0} class", ????); } } [MyAttribute] public class MyClass { } Can I fill in the "????" to answer this question? Do I have to iterate over every type in the list of known as...

MVCContrib, Html.Grid: How can I attach a row-based id to a td tag?

Here's my current view code: <% Html.Grid((List<ColumnDefinition>)ViewData["Parameters"]) .Columns(column => { column.For(c => c.ID); column.For(c => c.Name); }).Render(); %> I'd like to attach an HTML "id" attribute to each "name" td tag as such: <table class="grid"> <thead> <tr> <th>Id</th> ...

Python functions can be given new attributes from outside the scope?

I didn't know you could do this: def tom(): print "tom's locals: ", locals() def dick(z): print "z.__name__ = ", z.__name__ z.guest = "Harry" print "z.guest = ", z.guest print "dick's locals: ", locals() tom() #>>> tom's locals: {} #print tom.guest #AttributeError: 'function' object has no attribut...

jQuery image src attribute broken in IE7

I'm using jQuery (in an ASP.Net 2.0 website written in C#, FWIW) to handle a fairly simple div expansion and image swap (for display state indication) and it's working like a charm in FF 3.5.5 but failing in IE 7, and I'm wondering if you fine folks might be able to help me ascertain why that would be. I'm loading jQuery 1.3.2 from goog...

Can boost filesystem change the read-only attribute of a file?

Is there a way to change the attribute of a file from read-only to read-write using the boost filesystem library? If not, what is the next-best way to do this on Windows (using Microsoft's C++)? ...

Class attribute evaluation and generators

How exactly does Python evaluate class attributes? I've stumbled across an interesting quirk (in Python 2.5.2) that I'd like explained. I have a class with some attributes that are defined in terms of other, previously defined attributes. When I try using a generator object, Python throws an error, but if I use a plain ordinary list c...

splitting function attributes

Hi would it be possible to correctly split function attributes using regex ? i want an expression that splits all attributes in a comma seperated list. But the attributes themselves could be an Array or Object or something that can also contain commas : ex : 'string1','string2',sum(1,5,8), ["item1","item2","item3"], "string3" , {a:"tex...

What use does the *tag* attribute have in C#

Hey everyone, I've been working with C# for over a year now, and I was wondering what other functionality the tag attribute has of a control, till now each .net control I've used (buttons, labels, textboxes, gridview, etc.) have a tag attribute that you can define. I only know you can put something in it like a string of text. The vis...