properties

J2ME Properties

J2ME lacks the java.util.Properties class. Although it is possible to put application settings in the JAD file this is not recommended for many properties. (Since, some platforms limits the size of JAD file.) I want to put a configuration file inside my jar file and parse it. And I do not want to go with XML because it will be overshooti...

.NET Settings Relative Path

I am working on an application where I have an images folder relative to my application root. I want to be able to specify this relative path in the Properties -> Settings designer eg. "\Images\". The issue I am running into is in cases where the Environment.CurrentDirectory gets changed via an OpenFileDialog the relative path doesn't re...

Get the name of a property by passing it to a method

Hello, StackOverflow user jolson had a very nice piece of code that exemplifies how one can register menthods without using strings, but expression trees here. Is it possible to have something similar for properties instead of methods? To pass a property (not the name of the property) and inside the method to obtain the property name? ...

What happens when you make assignments to fields or properties of properties

Lets say you have a property like: Person person1; public Person Captin{ get{ return person1; } set{ person1 = value; } } public void SomeFunction(){ Captin.name = "Hook" } In this case if you set the name on the property we know that the new name of Hook will get applied to the underlying value ...

How to iterate through each property of a custom vb.net object?

How can I go through each of the properties in my custom object? It is not a collection object, but is there something like this for non-collection objects? For Each entry as String in myObject ' Do stuff here... Next There are string, integer and boolean properties in my object. ...

Populate Property Object during Property Call

Hello all, I'd like to know whether this approach is correct or if their are better ways of doing this. I have what is basically a Person class which has a number of other classes as variables, each of the custom classes is instantiated by passing the Person ID and then that class retrieves the data it needs using that ID. I expose the ...

loading properties file from java package

I need to read a properties files that's buried in my package structure. com.al.common.email.templates I've tried everything and I can't figure it out. In the end, my code will be running in a servlet container, but I don't want to depend on the container for anything. I write jUnit test cases and it needs to work in both. I can't figure...

What's the simplest way to override a Delphi property's default value?

I'm trying to write a TCustomDBGrid descendant that's designed to feel like a TListBox. One of the things I want to change is the Options property's defaults. TCustomDBGrid defines Options as: property Options: TDBGridOptions read FOptions write SetOptions default [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRo...

What point should you cache a value for a Property?

I've always wondered about when and where is the best time to cache a property value... Some of them seem pretty simple, like the one below... public DateTime FirstRequest { get { if (this.m_FirstRequest == null) { this.m_FirstRequest = DateTime.Now; } return (DateTime)this.m_FirstRequest; } }...

Filtering an Objects Properties by Name

I am doing some simple sanity validation on various types. The current test I'm working on is checking to make sure their properties are populated. In this case, populated is defined as not null, having a length greater than zero (if a string), or not equal to 0 (if an integer). The "tricky" part of this test is that some properties are...

Creating a DIP Switch control in WPF

In an effort to teach myself more about WPF, I'm trying to build a simple application. Where I work we have some hardware that has a bank of 8 dip switches used for setting an address from 0 to 255 (as an 8-bit number). It's a simple concept that I would like to build into a WPF windows application that would allow users to see the dip s...

How can I get the location of the JDK directory in Java?

Is there an similar property like System.getProperty("java.home") that will return the JDK directory instead of the JRE directory? I've looked http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#getProperties() and there doesn't seem to be anything for the JDK. ...

Custom UserControl Property used by child element

I'm trying to get some WPF concepts down, so I've put together a simple example of what I'm trying to do. I would like to set a custom property of a user control, and have it be used by an element within the control. I've been researching and experimenting, but I'm not fully understanding everything here. Any help would be appreciated. ...

Why does GetProperty fail to find it?

I'm trying to use reflection to get a property from a class. Here is some sample code of what I'm seeing: namespace ConsoleApplication1 { class Program { static void Main(string[] args) { System.Reflection.PropertyInfo[] tmp2 = typeof(TestClass).GetProperties(); System....

How can I specify system properties in Tomcat configuration on startup?

I understand that I can specify system properties to Tomcat by passing arguments with the -D parameter, for example "-Dmy.prop=value". I am wondering if there is a cleaner way of doing this by specifying the property values in the context.xml file or some other tomcat configuration file. I would like to do this because, first, it is eas...

Where to initialize a java Properties object?

I inherited an application which uses a java properties file to define configuration parameters such as database name. There is a class called MyAppProps that looks like this: public class MyAppProps { protected static final String PROP_FILENAME = "myapp.properties"; protected static Properties myAppProps = null; public st...

What is the best practice for using public fields?

When I write a class I always expose private fields through a public property like this: private int _MyField; public int MyField { get{return _MyField; } When is it ok to just expose a public field like this: public int MyField; I am creating a structure called Result and my intention is do this: public Result(bool result, string...

How do I get the name of a property from a property in C# (2.0)

I know I could have an attribute but that's more work than I want to go to... and not general enough. I want to do something like class Whotsit { private string testProp = "thingy"; public string TestProp { get { return testProp; } set { testProp = value; } } } ... Whotsit whotsit = new Whotsit(); ...

Form designer inconsistent in control display style for updated project

I've got a project that I started in Turbo Delphi, which I recently updated to D2009, and I've noticed a bit of a quirk in the form designer. All the old forms have a Win98 style applied to them. The buttons are gray with sharp square edges, for example. But any new form I've created since the upgrade displays its controls in WinXP styl...

Simple way to detect unused properties keys?

Given a set of properties files and list of files which may reference keys in those properties files, what's the easiest way to determine which keys are unused? Example: Given a project with files muppets.properties kermit=Kermit the Frog oscar=Oscar the Grouch smurfs.properties papa=Papa Smurf and /WEB-INF/pages/template.jsp S...