properties

How to get back Map from .txt file use Properties ?

This is code to write hashtable to .txt file ! public static void save(String filename, Map<String, String> hashtable) throws IOException { Properties prop = new Properties(); prop.putAll(hashtable); FileOutputStream fos = new FileOutputStream(filename); try { prop.store(fos, prop); } finally { fos.clos...

How to extract object reference from property access lambda

Here's a follow-up question to http://stackoverflow.com/questions/2820660/get-name-of-property-as-a-string. Given a method Foo (error checking omitted for brevity): // Example usage: Foo(() => SomeClass.SomeProperty) // Example usage: Foo(() => someObject.SomeProperty) void Foo(Expression<Func<T>> propertyLambda) { var me = propert...

Creating a property setter delegate

I have created methods for converting a property lambda to a delegate: public static Delegate MakeGetter<T>(Expression<Func<T>> propertyLambda) { var result = Expression.Lambda(propertyLambda.Body).Compile(); return result; } public static Delegate MakeSetter<T>(Expression<Action<T>> propertyLambda) { var result = Expressio...

Refreshing Read-Only (Chained) Property in MVVM

I'm thinking this should be easy, but I can't seem to figure this out. Take these properties from an example ViewModel (ObservableViewModel implements INotifyPropertyChanged): class NameViewModel : ObservableViewModel { Boolean mShowFullName = false; string mFirstName = "Wonko"; string mLastName = "DeSane"; private rea...

Is it correct to correct properties values on the fly?

Is it correct to correct properties values on the fly? for example: (note the .ToLower) Public Property X() As String Get Return _x.ToLower End Get Set(ByVal Value As String) _x = value.ToLower End Set End Property ...

.Net: Why we can't access to some properties of a control programmatically in winforms?

.Net: Why we can't access to some properties of a control programmatically in winforms? For example, "Locked" property of a groupbox is not accessible via code. So What Possibly can I do when I want to locked it programmatically ? Using Enabled = False will greyed out all controls within it and this is not what I wanna to be. Any Sugge...

C# style properties in python

I am looking for a way to define properties in Python similar to C#, with nested get/set definitions. This is how far I got: #### definition #### def Prop(fcn): f = fcn() return property(f['get'], f['set']) #### test #### class Example(object): @Prop def myattr(): def get(self): return self....

Change properties in pom.xml at runtime with Maven Ant Tasks. Is it Possible?

I have the following use case: My application is started with an Ant Script, which asks the user several questions about the project configuration (database settings etc.). These settings are stored in a properties-file. Then i want to run Maven from within my Ant script by Maven Ant Tasks, which should replace the pre-defined properti...

Sharing properties file from a single location.

We have Java Enterprise applications deployed on to multiple servers. There are replicated servers running same application to load-balance(let's call them J2EE servers).Note that this is not clustered. There is a common server (let's call it props server) which hosts all properties files relevant to all applications. The folder contain...

Is it possible to access the inner property of a JQuery plugin?

I'm trying to alter the extraParams in this plugin based on a user action. var t = new $.TextboxList('#entSearch', {unique: true, plugins: { autocomplete: { minLength: 3, queryRemote: true, placeholder: false, remote: { url: "{{=URL(r=requ...

Change spring bean properties at configuration time

In a spring servlet xml file, I'm using org.springframework.scheduling.quartz.SchedulerFactoryBean to regularly fire a set of triggers. <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref local="AwesomeTrigger" /> <ref local="GreatTrigger" /...

Memory management for "id<ProtocolName> variableName" type properties

Hi, I'm having a problem with properties of the following type: id<ProtocolName> variableName; ..... ..... @property (nonatomic, retain) id<ProtocolName> variableName; I can access and use them just fine, but when I try to call [variableName release]; I get compiler warnings: '-release' not found in protocol(s) Do I need to de...

How can I call model methods or properties from Django Admin?

Is there a natural way to display model methods or properties in the Django admin site? In my case I have base statistics for a character that are part of the model, but other things such as status effects which affect the total calculation for that statistic: class Character(models.Model): base_dexterity = models.IntegerField(defa...

With what methods can I dynamically set an ASPX Control Property before it is initialized?

I need to configure a property of a custom control I wrote, specifically before the control calls OnInit. If I assign it as part of the ASPX file, it naturally works, but if I instead move the assignment to different parts of the code-behind, it will throw an error for having an empty and invalid value. The following is what it looks lik...

How to publish a list of integers?

I want to make a component that includes a list of integers as one of its serialized properties. I know I can't declare a TList<integer> as a published property, because it doesn't descend from TPersistent. I've read that you can define "fake" published properties if you override DefineProperties, but I'm not quite sure how that works,...

MVVM Binding to Properties.Settings

In a MVVM approach how would I go about binding to Properties.Settings? Is there a way to bind a property in C# code(in the ViewModel) to another property(Properties.Settings.Default) or should i just bind to standard properties and on save make sure each property gets propogated manually to the Properties.Settings? ...

C# Access the Properties of a Generic Object

I have a method that counts the number of Contacts each Supplier, Customer and Manufacturer has (this is a scenario to try make explaining easier!) The models are all created by Linq to SQL classes. Each Supplier, Customer and Manufacturer may have one or more Contacts public int CountContacts<TModel>(TModel entity) where TModel : clas...

What are the benefits of using properties internally?

Encapsulation is obviously helpful and essential when accessing members from outside the class, but when referring to class variables internally, is it better to call their private members, or use their getters? If your getter simply returns the variable, is there any performance difference? ...

@property setter for BOOL.

Hi, I'm having problems setting a BOOL using @property and @synthesize. I'm using @property BOOL isPaused; And I can get it by using [myObject isPaused]; but I cannot manage to set it. I'd like to use [myObject setPaused: NO];. I also tried @property (setter=setPaused) BOOL isPaused; but if I'm not mistaking, then I need to write that s...

Strategies for when to use properties and when to use internal variables on internal classes?

In almost all of my classes, I have a mixture of properties and internal class variables. I have always chosen one or the other by the rule "property if you need it externally, class variable if not". But there are many other issues which make me rethink this often, e.g.: at some point I want to use an internal variable from outside th...