properties

Can Python modules have properties the same way that objects can?

With python properties, I can make it such that x.y calls a function rather than just returning a value. Is there a way to do this with modules? I have a case where I want m.y to call a function rather than just returning the value stored there. C ...

Is it true I should not do "long running" things in a property accessor?

And if so, why? and what constitutes "long running"? Doing magic in a property accessor seems like my prerogative as a class designer. I always thought that is why the designers of C# put those things in there - so I could do what I want. Of course it's good practice to minimize surprises for users of a class, and so embedding tru...

Why do property setters and getters clash with get_X and set_X methods?

In .NET properties are supposed to be first class citizens however in the IL code property getters and setters are implemented as get_PropertyName and set_PropertyName. class Property { int Value { get { return 42; } } int get_Value() { return 6 * 9; } void set_Value(int i) { } // Error even though Value is a read only prope...

Correct usage of properties when dealing with a collection.

I am wondering what is the best way to use properties when dealing with collections. For example I have a class Foo and I want to have a list of that class stored. Which of the following should be used: private List<Foo> myList; private List<Foo> myOtherList = new List<Foo>(); now for the property: public List<Foo> ListOfFoo { ...

Store Custom properties in aplicationContext.xml Spring file

Hello, I need to store some configuration parameters for a web application that uses spring framework. Typically I'll use a configurationfile.properties file but i wonder if i can store that values in the applicationContext.xml file. One workaround could be to create a JavaBean class to store the values, and build that class using spr...

Apply property setting to all like controls in Project in Visual Studio

Lets say I have multiple DataGrids throughout my winform app and I want to set the BackColor on ALL of them to Purple in Visual Studio. What is the fastest way of setting a Property for multiple items NOT located on the same Form? Thanks! ...

Error when attempting to pass a parameter to a t4 template

I'm trying (and failing) to write a simple template file: <#@ template language="C#" hostspecific="True" debug="True" #> <#@ output extension="cs" #> <#@ include file="T4Toolbox.tt" #> <#@ property name="ClassName" processor="PropertyProcessor" type="System.String" #> public class <#= ClassName #> { } When I click on the template in ...

Keeping i18n resources synced

I am looking for an editor/comparator for i18n property files that would help me keep different language files in sync. Basically, something that would compare a bunch a of property files and show which keys are not present in a particular language. a property would look something like component.titlepage.title = hello world A simpl...

How do I add custom properties to a form

I am trying to add a custom property to a base form that can be accessed via the Delphi property editor. If I simply add the property as I would with a standard component the property won't show up in the property editor. Here's what I tried: unit TestForm; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Con...

DependencyPropert not set from XAML with DynamicResource as parameter

Hello, I'm trying to develop a custom tri-state button user control and so far I've been using CTF to set properties. But I would like to change this to be using the WPF property system with PropertiesDependencies. Unfortunately I don't manage to make it work, when I set the property from my xaml (father) using a DynamicResource, the...

What's the best way to add a composite property for binding to an existing class

Let's say I have a Size class which has height and width properties (in reality the class is a bit more complex than this, but Size makes a good example). I want to display this as $width x $height in my UI. The obvious way to do this is to bind to a dimensions property which is dependent on width and height. My question is where is t...

(Simple) Can HTML properties be attributes or are they only for CSS?

The SVG spec talks about Properties.. what are these? Can they be declared as attributes inline with the element? .. or can they only be declared in CSS stylesheets? ...

Cast an object with Type T to Type T<System.Guid>

I inherited a project with a Windows mobile part. To make a long story short, my problem is this: [DBPropertyUpdate("CustomerId")] [DBPropertyRetrieve("CustomerId")] public CustomerBase<T> Customer { get { return _customer; } set { _customer = SetProperty(_customer, value); } } throws an exception. In a watch window I have th...

How to set author name for subversion when i'm using svn:keywords

i want to set my full name (or a name choosed by me) to appears in the $Id$ area on commit and not my nickname. There is a way to do it? Thanks in advance , Sirakov P.S. OS: Ubuntu 8.10 ...

C# stop property change at runtime

I have been trying to build a user control with some custom properties set in the designer. However the control involves some interop code and settings which shouldn't be adjusted at runtime. Is there a way to stop the values being changed after they have been initially set by the designer code? ...

C# return a variable as read only from get; set;

Hi all, I swear I have seen an example of this but have been googling for a bit and can not find it. I have a class that has a reference to an object and need to have a GET; method for it. My problem is that I do not want anyone to be able to fiddle with it, i.e. I want them to get a read only version of it, (note I need to be able to...

Packaging Jar

Hi, It has been a frustrating day trying to package multiple plugins and their property files into an executable jar. How to I package these plugins into a single jar, leaving the properties files outside: - pluginA with pluginA.properties - pluginB with pluginB.properties - pluginC that requires pluginA and pluginB The property files...

DBus interface properties

How do I get the list of available DBus interface properties? I am writing a script that would be tracking specific type of usb devices connections. A way to distinguish the connections to be tracked from all usb connections I guess is to check the properties of signals' interfaces DBus is sending on a usb connection. I'd like to get th...

Share properties among multiple classes

Hi All, I've a class with few properties A, B, C. I consider this as an input object as I use this in the logic to run some rules based on the values of these properties. Now, after running the rules, I created another class as an output with the same properties and with same values in addition to few other properties specific to the out...

What is the best practice for the location of Java application configuration files?

Is there a best practice for where configuration files should be stored in a Java project. The file type is a Java properties file in this case, but I do use other file types in other projects. Would the recommendation vary from stand alone application(.jar) to web app(.war)? ...