properties

Why use javabean bound properties instead of events?

What exactly is the point of bound properties? To me they seem to be a less type-safe version of events using EventObjects - it seems a bit weak to be using string equality checking for event.getPropertyName(). Why would you use one over the other? ...

How to provide a dynamic property?

I am using a class with a string property on it. I am looking for some sort of event notification when somebody reads the value of this property, so that I can provide the property dynamically. For example, usually somebody would do: string foo = someClass.Property; And it returns whatever string value is currently assigned to Propert...

Is it a bad idea to have a property table in a database?

Often, when I need to store system properties like admin info, versions, and so on, I use a flat file (database.properties, init.properties, etc). This seems common in other programs that I see and use on a daily basis. Sometimes a flat file isn't ideal for a number of reasons. Deploying a web app to numerous clients often comes with ...

Setting and displaying a property in a WPF UserControl

Am i missing something here? I have created a usercontrol with a property and for arguments sake it has a text box in it. <UserControl x:Class="Isd.Utility.SystemMonitorWpf.Bar" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <TextBlock x:Name="txtExpected" G...

Is it safe to allow two threads to edit different properties of the same object at the same time?

I am writing a cataloging application that parses through and extracts information from files and stores the information from each file in an object instance. In addition to the data extracted from the file the objects also have additional meta data properties (author, tags, notes, etc..) which later get stored in a separate XML file. E...

.NET DefaultValue attribute

I've heard people say a few different things about the DefaultValue attribute including: "It sets the value of the property before anything else uses it." "It doesn't work for autoproperties." "It's only for decoration. You must manually set actual default values." Which (if any) is right? Does DefaultValue actually set default...

Manifest vs Properties file format

After some searching on Google and here, I still haven't found any answer to the following: Is there a reason that JAR manifests don't just use the properties format? I am guessing this is historical but it would be nice to know how exactly this came to be was the decision not to use properties format explicitly made or was the proper...

What is the best practice for using .NET Properties?

I am a little confused about how much I SHOULD do with properties. I have heard that properties should always represent a logical property of the class. Get and Set should almost never throw exceptions with the exception of ArgumentOutOfRange. Is that true? Is the following example totally wrong? public bool DeviceRegistered { get{ ...

How to have multiple selectable options property listed in Properties Window? - .NET

I have a UserControl with a property called "Type". This can have any combination of three values, say One Two Three How do I do this? This is more like the anchor property for controls in WinForms. ...

Why are all the lines returned by `svn blame Foo.cs` blank?

I have a file in my Subversion repository named "Foo.cs". When I run the command svn blame Foo.cs the output looks something like this: 1000 dave 1000 dave 2000 dave 2000 dave 9999 dave 1000 dave 9999 dave The only thing that I can think of is that from revisions 1000-9000, Foo.cs had the "svn:mime-type" property set to "application...

appSettings vs applicationSettings. appSettings outdated?

I've got some question about two ways to save settings in the web.config. Appsettings: Look in web.config <appSettings> <add key="key1" value="value1"/> <add key="key2" value="value2"/> </appSettings> Usage in code-behind: ConfigurationManager.AppSettings["key1"]; ApplicationSettings/ Properties (autogenerated by using the 'prop...

How do I access the Document Class' properties from the time line in AS3?

I am building your standard slideshow flash header for a web page. There are three main parts: The Slideshow class A controller class that is used as the projects Document Class Some linking timeline code. The slideshow class has all the functionality, so I used the Document class to create a new instance of the slideshow and ke...

jQuery - Accessing object properties from within another object that was passed to an event

In an earlier question I worked out how to store object as properties. Now I am trying to access those properties when the object is passed through an event but can't get it to work: <script language="javascript"> $(document).ready(function() { //create a TestObject function TestObject() { this.testProperty = "green";...

ivars and how to properly instantiate their values (iPhone)

Hi I have been developing an app for a while and now I have gotten to the "Instruments-Leaks" part. I remember a thing that puzzled me about ivars a few months back when I was learning. I took the whole thing a bit on faith and just followed the way Apple and others did it. As far as I can read, the accessors generated by the SDK will ...

Spring: Programmatically use PropertyPlaceHolderConfigurer on none Singelton Beans

Hi, I'm aware that the following implementation of a PropertyPlaceHolderConfigurer is possible: public class SpringStart { public static void main(String[] args) throws Exception { PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setP...

Set properties of a class only through constructor

Hi , I am trying to make the properties of class which can only be set through the constructor of the same class ...

Spring: PropertyPlaceHolderConfigurer to set values for non-string/integer properties

Hi, All the examples I have seen where the PropertyPlaceHolderConfigurer is used seem to be setting simple values like Strings and ints. How do you use the PPC to set the values of classes. E.g. If i had a class signature Source(String name, DistributionSample batch, DistributionSample delay) How would I go about setting the batch...

Are Java Properties effectively deprecated?

Java's Properties object hasn't changed much since pre-Java 5, and it hasn't got Generics support, or very useful helper methods (defined pattern to plug in classes to process properties or help to load all properties files in a directory, for example). Has development of Properties stopped? If so, what's the current best practice for ...

Howto access properties file from jee web application?

Hi, I have created a dynamic web project within Eclipse. I created a properties file inside the src directory: <project-root>/src/props.properties I'm starting Tomcat via Eclipse in debug mode. Now I want to read the properties file from one of my POJOs, but I get a FileNotFoundException. The current path seems to be the Eclipse path...

Protected Set in VB.Net for a property defined in an interface

We have an interface, which can be grossly simplified as: public interface IPersistable<T> { T Id { get; } } Most places that implement the interface want to have it so that there is a protected or private set on that property, i.e, in C#: public class Foo : IPersistable<int> { public int Id { get; protected set; } } Howeve...