attributes

remove extended attribute : fails

From a shell script, I'm trying to remove extended attribute setfattr -x security.selinux file.txt The file.txt has mode as 777 but im getting "permission denied error" How to fix this ...

Extending Enums, Overkill?

I have an object that needs to be serialized to an EDI format. For this example we'll say it's a car. A car might not be the best example b/c options change over time, but for the real object the Enums will never change. I have many Enums like the following with custom attributes applied. public enum RoofStyle { [DisplayText("Gl...

Using LINQ and Reflection: How to query for all Classes with [Authorize] Attribute in my Assembly?

Currently, I'm trying to identify which "Controller" classes in my assembly have the [Authorize] attribute associated with them using Reflection and LINQ. const bool allInherited = true; var myAssembly = System.Reflection.Assembly.GetExecutingAssembly(); var controllerList = from type in myAssembly.GetTypes() where ...

How can I get Text property to initialize to the objects name at design time?

When you add a label to the form from the toolbox, its text defaults to the item's name (label1, label2, etc). How can I make this happen with a custom control? So far, I have the following, which allows me to change the text through the property window: private string _text; [BrowsableAttribute(true)] public override string Text { ...

Give a reference to a python instance attribute at class definition

I have a class with attributes which have a reference to another attribute of this class. See class Device, value1 and value2 holding a reference to interface: class Interface(object): def __init__(self): self.port=None class Value(object): def __init__(self, interface, name): self.interface=interface se...

Override jQuery style value

Hi To resolve a jQuery slideDown/Up problem, I had to change one line in the jQuery file. I changed line 5738 from this.elem.style.display = "block"; to this.elem.style.display = "inline-block"; The block attribute messed up my lists when using slideDown/Up/Toggle. slideDown changes my list from display:inline to display:block during ...

HTML5 How To Skip Navigation When Name Attribute Is Obsolete

In the Web Content Accessibility Guidelines is states that you should supply a "skip" link that jumps you (for example) over a navigation block and straight into the content. This is particularly useful for impaired users who use a screen-reader to describe a page audibly. 6.2 Grouping and bypassing links WCAG Guidelines However, this ...

How can data be passed into an <s:> tag within a Struts tag file via attributes?

I have a form with two halves, one for attaching a wide thumbnail to an asset and one for a standard-size thumbnail. The jsp file generating the page calls thumbnail.tag, which calls thumb.tag twice: <thumbnail:thumb label="75px Thumbnail" /> <thumbnail:thumb label="Wide Thumbnail" /> thumb.tag in turn has the following: <s:if test="...

Is the order of attributes in a certain tag releveant?

Is the order of attributes in a certain tag releveant. Specific case: This is from a selenium testfile. Given a testcasse <?xml version="1.0" encoding="UTF-8" standalone="no"?><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head profile="http://selenium-ide.openqa.org/profiles/test-case"&gt; <meta content="text/htm...

How can I define SettingsProperty.DefaultValue in my inherited ProfileBase class?

You can create custom profile properties in Web.config like so: <configuration> <system.web> <profile> <providers>...</providers> <properties> <add name="MyCustomProperty" allowAnonymous="false" type="MyCustomType" serializeAs="String" defaultValue="MyCustomType.Empt...

How Do I Programmatically Set a File Tag

When using Windows Explorer to view files, I'm given the option to set a "tag", "category", or other attributes. For a JPEG a different set of attributes (including "tag") are options. I'd like to be able to set these programmatically. How do I programmatically set a file tag and other file attributes using Delphi (I have Delphi 2010 ...

Use Lambda in Attribute constructor to get method's parameters

I'm not even sure if this is possible, but I've exhausted all of my ideas trying to figure this out, so I figured I'd send this out to the community and see what you thought. And, if it's not possible, maybe you'd have some ideas as well. I'm trying to make an Attribute class that I can add to a method that would allow me to use a lambd...

In C#, can an attribute be applied to a static class, method or property?

Hi there, I was just wondering if an attribute can be applied to a static class, method or property in c#? Like, [MyAttribute] public static MyMethods(string str) ... Thanks Ray. ...

XPath to compare two distinct attributes of two elements

Suppose I have this XML: <x> <e s="1" t="A"/> <e s="2" t="A"/> <e s="1" t="B"/> </x> Is there any way to write an xpath to find whether there are two distinct nodes named "e" which have the same value for @s but different values of @t. The first part is easy: //e[@s = //e/@s] as is the second part: //e[@t != //e[@t]] But I don'...

Python Attributes and Inheritance

Say I have the folowing code: class Class1(object): def __init__(self): self.my_attr = 1 self.my_other_attr = 2 class Class2(Class1): def __init__(self): super(Class1,self).__init__() Why does Class2 not inherit the attributes of Class1? ...

How to use custom attributes over a web service?

Hi. I am currently trying to add a custom "column name" to a property in a web service. Here is my class. public class OrderCost { public int OrderNum { get; set; } public int OrderLine { get; set; } public int OrderRel { get; set; } public DateTime OrderDate { get; set; } public string PartNum { get; s...

Element Content Versus Attribute for Simple XML Value

I know the elements versus attributes debate has come up many times here and elsewhere (e.g. here, here, here, here, and here) but I haven't seen much discussion of elements versus attributes for simple property values. So which of the following approaches do you think is better for storing a simple value? A: Value in Element Content: ...

jQuery update link

Here is html: <a href="http://site.com/any/different/folders/picture_name.jpg"&gt;Go and win</a> <a href="http://site.com/not/similar/links/some_other_name.png"&gt;Go and win</a> How to add some text after last "/" in href attribute (before picture_name.jpg) of each link? The script should give something like: <a href="http://site.c...

Adding additional sorting attributes to array of records...then sorting!

Let's say I run an ActiveRecord query and it returns 3 results, with a bunch of attributes. I want to add 3 attributes to each record in the Array so I can do sorting at a code-level. These 3 include: num_comments, num_views, last_view. How do I add these attributes? How do I then sort the records, in order of precendence, by num_comm...

How do I initialize attributes when I instantiate objects in Rails?

Clients have many Invoices. Invoices have a number attribute that I want to initialize by incrementing the client's previous invoice number. For example: @client = Client.find(1) @client.last_invoice_number > 14 @invoice = @client.invoices.build @invoice.number > 15 I want to get this functionality into my Invoice model, but I'm not ...