properties

How to lock a setter property for a thread.

I am running four threads that gets and sets the same property. When i uses breakpoint then it gives me result as expected but when i runs it directly it gives me last updated result. Here is my code int Port { get; set; } Thread[] tMain= new Thread[4]; public void btnListen_Click(object sender, EventArgs e) { for...

Enumerating Structs and Classes for Properties at Design Time

How can I write my own structs which can be used as a property during design time? I need to be able to specify a default value, and have a selectable list of pre-defined structs for the designer to pick from, in much the same way as Color properties are implemented. Furthermore, how can I do this with classes, like Font does? How can y...

config files for a webapplication - load once and store where?

I have a bunch of properties (configurations) that can change per environment. However these values do not change once the web application is deployed.So consider that there is an application.properties file that I want to read lots of times during normal program flow. I know that I can probably load these at server startup time. Howeve...

Whats a good configuration format that is not strict on syntax or format ?

I have an existing system that I do not wish to change where I would like to add meta-data/configuration/annotations to an existing user object/entity. I do not want to change the schema or UI so I am planning on letting the user add this meta-data through a description field of the object where users normally enter in a description. It...

Any advantage to objects.GetObject(i) over objects[i]?

I'm refactoring a little bit of C# data access code from a previous developer and am curious about a pattern he used. The code initially exposed collections (arrays) of a variety of ActiveRecord-style business objects - essentially objects wrapping database fields. I'm changing the arrays to generic lists, but the aspect of the code I'...

How to read properties file in web application?

Properties file location is WEB-INF/classes/auth.properties. I cannot use JSF-specific ways (with ExternalContext) because I need properties file in a service module which doesn't have a dependency on a web-module. I've already tried MyService.class.getClassLoader().getResourceAsStream("/WEB-INF/classes/auth.properties"); but it ret...

Spring + Maven: separate property files for unit tests and integration tests

I'm using Spring 2.5.6 and building my project with Maven 2.2.1. We use PropertyPlaceholderConfigurer beans in Spring to load up properties for configuring things like the database. Pretty standard stuff. We also have two different sets of tests: unit tests and integration tests. I would like to be able to use different property files ...

PropertyPlaceholderConfigurer reads from XML File (Apache Commons Configuration)

Is there a possibility to configure the Spring PropertyPlaceholderConfigurer to read from properties.xml, via Apache Commons Configuration? ...

Is there a performance difference between properties vs. backing fields in read/write operations?

When working within a class on its own fields and properties, I typically only use the property when it performs some function (like limiting a value or validating or whatever). Otherwise I prefer to read/write the backing field directly. I somehow got it in my head that this would be a more generally performant way to do things, but i...

Why is it allowed to set a property that doesn't set anything in C#?

I've been reviewing the PRISM toolkit and I find many examples where they declare a public property with empty getters/setters yet they can still set the property of the instantiated class. How/why is this possible? public class ShellPresenter { public ShellPresenter(IShellView view) { View = view; ...

Protected Internal properties vs Protected properties and Resharper

I've just picked up Resharper and have been playing around converting fields to properties. I want these properties to be protected, but Resharper doesn't want to give me that option. Instead there is only a Protected Internal option. This has me thinking. Either there is a rule somewhere that properties should always be 'protected inter...

Java Property Annotation Standard/Library

I am trying to create a library which depends heavily on annotating class properties. The properties should be able to be annotated via getters or on the actual underlying fields (ala JPA etc.) Is there some standard for this? Tons of libraries do this (e.g. Hibernate). Do they all just roll their own implementation and conventions? Is ...

Can a JavaScript object property refer to another property of the same object?

I recently tried to create an object like this: var carousel = { $slider: $('#carousel1 .slider'), panes: carousel.$slider.children().length }; My intentions were to improve jQuery's selector performance by caching the results of $('#carousel1 .slider') in an object property, and to keep the code concise and relatively...

iphone declare property correctly

Hi all, I have this problem: I have my code into my view that connect to internet to retrieve some info and populate a uitableview, and works fine.. To make order to my code I created my class derived to nsobject and I added all my code inside it... the table is populated, but the app retrieve bad_access... I think that the problem is th...

Maven properties in gwt.xml

How do I use a Maven properties from pom.xml in my.gwt.xml? ...

What does *width:auto mean in CSS?

Can anyone please tell me what does *width:auto; mean in css? For example: div.ReportingControls dd { width:450px; *width:auto; } Thanks ...

Storing custom properties in resx files in Compact Framework

We are developing a CF application and are making use of the default localization/resource handling in the framework (that is, when editing a form in the designer properties like Text have their value stored in the .resx files and the resource manager and framework loads it for us again in the selected locale using satelite assemblies an...

How to handle multiple properties on iPhone's addressbook?

The problem is that I always get runtime crashes at any method invoked at phones variable. At this version I get an error at 1 (ABMultiValueCopyValueAtIndex). If I'll comment this line, the code crashes at 2 (ABMultiValueGetCount). It looks like the property was empty. If I NSLog the phones variable. I get (null). I test the code on iPho...

Best way to create a strongly typed wrapper for Dictionary<string, string>

I have a Dictionary containing configuration values for other classes (tasks which will be executed periodically performing assorted specialized logic) which are persisted in a database and then passed back in at execution time. I want to create a strongly typed wrapper for this Dictionary, both to allow easy access to the values and to...

Updating properties for multiple users

How do I update a list of different Telephone, IPPhone using this static void Main(string[] args) { Console.Write("Enter userid : "); // I would pass this in from the first //Field in the .csv file 2439009 String username = Console.ReadLine(); try ...