properties

Commons configuration - JNDIConfiguration - How to?

I usually use Commons Configuration for manage my applications configs. I have used properties files configuration. Now I'm interested in using a JNDIConfiguration but I'm not able to understand how this works reading the documentation or googling it. Contextualizing, I'm working in webapps running in an JBoss AS. Where will be the pro...

Is the C# compiler smart enough to optimize this code?

Please ignore code readability in this question. In terms of performance, should the following code be written like this: int maxResults = criteria.MaxResults; if (maxResults > 0) { while (accounts.Count > maxResults) accounts.RemoveAt(maxResults); } or like this: if (criteria.MaxResults > 0) { while (accounts.Count ...

Why ever use fields instead of properties?

I'm fairly new to C#, and I think properties are a wonderful thing. So wonderful, in fact, that I can't see any real advantage to using fields, instead. Even for private fields, it seems like the flexibility and modularity that properties offer can at best save you serious headaches, and at worst have no effect at all. The only advantag...

Why can't properties be readonly?

This question came up in the comments of this answer. The inability to have readonly properties was proposed as a potential reason to use fields instead of properties. For example: class Rectangle { private readonly int _width; private readonly int _height; public Rectangle(int width, int height) { _width = width; ...

wpf defining custom properties for styles

I have created a custom button by using a Style and a Control template. I would like to define some custom properties for this button such as ButtonBorderColour and RotateButtonText. How do i go about this? Can it be done just using XAML or does it require some C# code behind work? ...

msiexec does not pass parameters to custom action

Greetings, I have a custom action inside an MSI installer that makes some changes to some configuration file. my requirement is to run the installation in silent mode so I am using msiexec. Here is the command: msiexec /i myInstaller.msi /l* out.txt myContextParameter=value1 myContextParameter is never passed to the custom action so ...

Have a getter return the value of a private var's property

Say I have type TLight = class private Ftimer : TTimer; property IsAutoRotating: Boolean read Ftimer.Enabled; Obviously, this doesn't compile, but why not and how to solve this (preferably without keeping that state in a seperate var. ...

Accessing masterpage properties from child pages in ASP.net VB

I have masterpage.master.vb where I have properties, such as; Private _SQLerror As String Public Property SQLerror() As String Get Return _SQLerror End Get Set(ByVal value As String) _SQLerror = String.Empty End Set End Property Then I have an aspx page in which I need ...

How can I read contents from Spring Messagesource within a Enum?

I have an Enum containing three different Status types. These statuses should be displayed in an email sent to users, and the strings containing the statuses to be displayed are stored in messages.properties (read using an implementation of Spring class org.springframework.context.MessageSource). This works well in a normal Spring contro...

C# How do I create code to set a form back to default properties, with a button click event?

Using Visual C# 2008 express edition, I am trying to create a button on my form to set the form back to default properties, such as size, backcolor, etc... anybody have any examples on how I would do this? ...

Expressing markup in Java XML property files: CDATA vs. escaped tags

I am reading and writing Java Properties files in XML format. Many of the property value have HTML embedded, which developers wrap in [[CDATA elements like so: <entry key="foo"><![CDATA[ <b>bar</b> ]]></entry> However, when I use the Java API to load these properties and later write them back to XML, it doesn't wrap these entries ...

How is release handled for @synthesized retain properties?

I have some questions about synthesized properties in Objective-C. The full list follows, but the basic question is this: How does the compiler ensure that the ivars for synthesized properties are properly released, even though my code may or may not include release methods in dealloc? Note: I decided not to post these as individual que...

Translucent colors in Java through properties files

Hi all, Is it possible to specify a color in a properties file that has an alpha component? When I put a hexadecimal number in the properties file that has an alpha channel, the alpha is ignored. I notice that the decode method of string says "Converts a String to an integer and returns the specified opaque Color.", and that the only ...

Generate properties programatically

I want to load a properties file (it's a .csv file having on each line a name and associated numeric value) and then access those property values like so: FileLoader.PropertyOne or FileLoader.PropertyTwo. The problem is I don't want to have to write a property for each value, I want them to be generated from the file. So public class F...

referencing a directory from a different project in the properties file of another project

I am a Java novice I am using Eclipse and I have a project (say Main Project) which has in its build path another project (let's call it Second Project). I need to write in the directories section of the properties file of the Main Project the address of certain files which are part of the Second Project (and as result stored in the S...

Load environment-specific properties for use with PropertyPlaceholderConfigurer?

This seems like a pretty common problem, but I haven't found any sort of consensus on the best method, so I'm posing the question here. I'm working on a command-line Java application using Spring Batch and Spring. I'm using a properties file along with a PropertyPlaceholderConfigurer, but I'm a little unsure of the best way of handling ...

Dynamic Placeholder substitution in properties in java

Hi, I wanted to substitute the placeholder dynamically in properties in a java application. Like WelcomeMessage=Welcome Mr. {firstName} {lastName} !!! These firstName and LastName variable needs to be substituted dynamically. Should we use velocity template engine for the same? Or are there any other opensource frameworks for the sa...

Fluent NHibernate - Intercepting/Injecting DDL

This would be a great feature - to dress my Domain objects with class and property attributes, such as [Description("The 'Cat' entity holds information about Cats")] public class Cat { [Description("The Cat.Name property holds the real name of the Cat such as 'Fluffy'")] public virtual string Name { get; set; ...

Use enum to select string from wicket properties file

I'd like to add a label to a wicket panel where the label's model is an enum value. Based on the value of that enum, I'd like to display a different message pulled from the page's properties file. For example, here's an enum: public enum ApprovalType { UNAPPROVED, APPROVED, BLOCKED }; I can easily add a label to the panel that has t...

Should a User Control's Controls be backed by Properties?

Hopefully I am stating that right. I have a WinForm(3.5) app that has 1 Form that is broke into two regions. 1 is the Navigation and the other, a Panel, is the Content. You select what you want in the Navigation Portion, i.e. Demographics, and then it embeds a UserControl containing all the Demographics controls in the Panel. What I ...