attributes

Saving custom attributes in NSAttributedString

I need to add a custom attribute to the selected text in an NSTextView. So I can do that by getting the attributed string for the selection, adding a custom attribute to it, and then replacing the selection with my new attributed string. So now I get the text view's attributed string as NSData and write it to a file. Later when I open t...

Set JavaScript events in WebBrowser control

Hi I have a WebBrowser control and try to set onclick and href attributes on all links. foreach (HtmlElement link in webBrowser1.Document.Links) { link.SetAttribute("href", "http://www.google.com"); link.SetAttribute("onclick", "return false;"); } It works well. When i out source code of outer html i see that attributes w...

EndPointDispatcher and Attributes set on the service or service contract

I am using WCF and IServiceBehaviors, and adding EndPointDispatchers. What I would like to check is that on the EndPointDispatcher is there any way of check to see which attributes have been set on the Service or Service Contract? The reason for doing this is that if a Service has an attribute then a new Inspector will be added if not...

Is there a standard .NET exception to throw when a class doesn't implement a required attribute?

Suppose I want to throw a new exception when invoking a generic method with a type that doesn't have a required attribute. Is there a .NET exception that's appropriate for this situation, or, more likely, one that would be a suitable ancestor for a custom exception? For example: public static class ClassA { public static T DoSomet...

XML schema - how to bind existence of one attribute to existence of another attribute

Hellow all, I have the following xml lines: <customer id="3" phone="123456" city="" /> <!--OK--> <customer id="4" /> <!--OK--> <customer id="3" phone="123456" /> <!--ERROR--> <customer id="3" city="" /> <!--ERROR--> "phone" and "city" attributes are optional, but if "phone" exists, a...

How to get a Token from a Lucene TokenStream?

I'm trying to use Apache Lucene for tokenizing, and I am baffled at the process to obtain Tokens from a TokenStream. The worst part is that I'm looking at the comments in the JavaDocs that address my question. http://lucene.apache.org/java/3_0_1/api/core/org/apache/lucene/analysis/TokenStream.html#incrementToken%28%29 Somehow, an Attr...

Multiple roles with attributes(?) in Capistrano

How can I pass along attributes to my tasks in capistrano? My goal is to deploy to multiple servers in a load balancer. I'd like to take each one out, deploy, and add it back in sequentially so no more than one server is down at any time. I'm thinking it would be something along the lines of... (and the hosts array would be generated d...

How do you get an asp.net control's auto generated name attribute?

I have a DropDownList and need to know its name in the code behind: <select name="ctl00$cphMainContent$ddlTopic" onchange="javascript:setTimeout('__doPostBack(\'ctl00$cphMainContent$ddlTopic\',\'\')', 0)" id="ctl00_cphMainContent_ddlTopic"> <option value="All">All</option> </select> I need to get the value "ctl00$cphMainContent$ddlTop...

How do you reflect on an attribute applied to a return value?

Consider the following: [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue)] public class NotNullAttribute : Attribute { } public class Class1 { [return: NotNull] public static string TestMethod([NotNull] string arg) { return arg + " + " + arg; } } How, using System.Reflection, would you...

What's the point of indicating AllowMultiple=false on an abstract Attribute class?

On a recent question about MVC attributes, someone asked whether using HttpPost and HttpDelete attributes on an action method would result in either request type being allowed or no requests being allowed (since it can't be both a Post and a Delete at the same time). I noticed that ActionMethodSelectorAttribute, from which HttpPostAttr...

lambdas and attributes in c#

Can you use a lambda expressions as an argument to an attribute? The motivation I am thinking of would be to eliminate reliance on magic strings Cheers, Berryl ...

jquery change attribute

hi, i have 4 links and i need to change the href attribute in a rel attribute. i know i cannot do it so i'm trying to get the data from the href attribute, setting a new attribute (rel), inserting the data inside it and then removing the href attibute. basically i'm doing this: $('div#menu ul li a').each(function(){ var lin = $...

Symfony 1.4: Storing an array in session with SetAttribute

Hi, I'm wondering if someone knows how to store an array into a user session? This is the method to store a single attribute: $this->getUser()->setAttribute('something', $something); And the documentation says: "User attributes can store any type of data (strings, arrays, and associative arrays)" ... but doesn't say anything more....

Practical usage for Delphi's new RTTI - Attributes,Values

I found great explanation about the new RTTI in Delphi,but I don't understand one important thing about all I have read - Where can I use that? What is it supposed to replace? ...

C#/.NET: Retrieving the contents/file attributes from a file inside a recycle bin

Hi, I just wanna ask if there's a possibility to retrieve the contents of a 'dump' file from the recycle bin programatically. The contents that I'm looking for are file attributes like 'Date Last Modified, 'Data created', 'size', etc (without restoring the file itself to the original location to preserve the original attributes found wh...

How to dynamically set validation messages on properties with a class validation attribute

I'm writing Validation attribute that sits on the class but inspects the properties of the class. I want it to set a validation message on each of the properties it finds to be invalid. How do I do this? This is what I have got so far: [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public class Li...

Difference between implementing an interface and applying an attribute in C#

This might be a stupid question but Ill ask anyway, I was reading "OOP Demystified: A Self-Teaching Guide by Jim Keogh and Mario Giannini" chapter 11 which covers interfaces. The examples in this book are C++. I noticed that C++ uses ISerializable to make a class serializable which you would implement where as in C# you just attribute ...

Define an <img>'s src attribute in CSS

I need to define an <img>'s src attribute in CSS. Is there a way to specify this attribute? ...

How do attribute classes work?

My searches keep turning up only guides explaining how to use and apply attributes to a class. I want to learn how to create my own attribute classes and the mechanics of how they work. How are attribute classes instantiated? Are they instantiated when the class they are applied to is instantiated? Is one instantiated for each class ...

MVC 2 - Name Attributes on HTML Input Field when using Parent/Child Entities

Hi All, I'm pretty new to MVC 2 using the Entity Framework. I have two tables Company {ID int identity PK,Name nvarchar} and User {ID int identity PK,UserName nvarchar,CompanyID int FK}. A Foreign Key exists between User and Company. I generated my ADO.NET Entity Data Model, a Controller and a view to insert a record. My HTML form has...