properties

override a class/add properties to a ListviewItem (vb.net)

I have a listview but I would like to add 3 properties (for example one of them is "image") to the listviewitems in it. I was fine with making a custom class with the 3 properties and just inheriting ListViewItem but now I need to use MultiSelect, so it means doing things like(in For Each loops): ListView1.SelectedItems.Item(i).Image do...

issue in property file

I want to load the property file when tomcat is starting.so I'm using servletContextListener to do that and i can get values of property file to my web application. But i want to keep the same value after changing the property file once log into web application.But when i change the value of property file and log into system again it cha...

Refactoring help...property-based object or lots of member fields?

I'm currently refactoring a class which currently looks something like this: class SomeModel { private String displayName; private int id; private boolean editable; private int minimumAllowedValue; private int maximumAllowedValue; private int value; // etc. etc.... a bunch (10+) of other fields... // an...

How to order properties in a declaration block?

I know there's no real right or wrong answer. I'd just like to hear from CSS developers how you like to order your properties and what is your reasoning behind your preference. Thank you very much. ...

Python - test a property throws exception.

Given: def test_to_check_exception_is_thrown(self): # Arrange c = Class() # Act and Assert self.failUnlessRaises(NameError, c.do_something) If do_something throws an exception the test passes. But I have a property, and when I replace c.do_something with c.name = "Name" I get an error about my Test Module not being im...

C# Access Modifier depending on state

Assuming an Order(Aggregate class) with Credit Card class as a property. Depending on the state of Order I want to change the access modifier of the Credit Card class properties. For example: if Order state = Order.NewOrder, then allow Credit Card properties to be modifiable, however if Order state = Order.CompletedOrder, I do not want t...

Property as parameter? C#

So I've got a whole bunch of options, every different page/tab can have their own local options. We'll have maybe 10-15 pages tabs open tops. I need to implement a way to show the global defaults, weather the all the tabs have consistent values. I'm working on the model/viewmodel portion of a WPF app. I'd love to find a way that is m...

Options, Settings, Properties, Configuration, Preferences — when and why?

There are several words with similar (in some sense) meaning: Options, Settings, Properties, Configuration, Preferences English is not my native language. Could you explain the difference in simple English please? I think the following template could be useful: Use XXX in your GUI in order to let people change behaviour of y...

OO: Should you access your private variables through properties inside your class?

I was wondering, what is good practice: private int value; public int Value { get { return this.value; } } private int DoSomething() { return this.Value + 1; //OR return this.value + 1; } So, the question is about how you should treat your class variables. Should you access them through your properties or just...

PHP Access sub property by name at runtime

Hello! Is it possible to access a sub-property of an object dynamically? I managed it to access the properties of an object, but not the properties of a sub-object. Here is an example of the things I want to do: class SubTest { public $age; public function __construct($age) { $this->age = $age; } } class Test...

No binding error but still binding does not show anything?

Hello, what do I have to change in my xaml/code to make the binding to the properties => SchoolclassName and LessonName work on both TextBlocks? I get no Binding errors but I do not see anything displayed? <Grid Margin="20" Height="300" Background="AliceBlue"> <ListView ItemsSource="{Binding Timetable}"> <ListView.V...

User Control - Custom Properties

Hello All, I have developed a User Control in Visual Studio (WinForms C#) and have a question. I need the user of my User Control to be able to change certain string values and I would like them to be able to add the user control to their Form and click on it to bring up the Properties Pane where my User Control's custom properties wil...

iPhone: ViewController as a tab bar

Hey guys I need some help with this: I have two view controllers, let's say: FirstViewController (first) is inside a navigationviewcontroller SecondViewController (second) So in the first's viewDidLoad method I have this: SecondViewController *second = [[SecondViewController alloc] initWithNibName:...]; [self.addsubview:second.vie...

How to assign managedObjectContext to a dynamic viewController???

I have 4 buttons on main screen, each one sends me to a viewController. The third one, sends me to a view on which I wanna set the managedObjectContext. If I use the class name to create an instance, it's all right. But I'm looking for a way to use just one method that uses an array to retrieve the name of the Class for the needed viewCo...

"Tell, don't ask": what is the difference between a non-void method and a getter?

How might I justify using a non-void method while not using any property getters? What is the distinction between these two concepts such that getters are evil but non-void methods are acceptable? EDIT: int CalculateSomething(); int Calculation { get; } The fact that I can change the signature of CalculateSomething and pass values ...

Is multiple assignment a hack in Obj-C?

So, I've got a class (IKImageView) with a bunch of properties. I know that view setProp: BOOL returns void. However: BOOL b = view.prop = NO; seems to work. If I had a function f() that returns a boolean, does anyone know if this is really doing: [view setProp:f()]; Bool b = [view getProp]; or [view setProp: f()]; Bool b = f(); ...

Quirks of Visual Studio's property pane with WPF

Working in the visual designer of a WinForm project, when one selects an element the properties pane lists all the properties for that element. Selecting a property in the properties pane then displays a description for that property (the value of the assigned DescriptionAttribute) in a property description box immediately below the list...

Best location for properties file

I'm working on a small java application that needs to load/save configuration properties. At first I tried using a properties file that lived inside the jar but I was concerned if someone were to upgrade to a later version (replace the existing jar) they would loose all of their settings. My next idea was to write the configuration file...

Is there a way to do this with Auto Properties?

I have code that looks something like this: Card m_currentCard; public Card CurrentCard { get { return m_currentCard; } set { m_currentCard = value; QuestionLabel.Text = CurrentCard.Question; } } It doesn't do anything special in terms of getting and setting the value of the property, but it does something ...

Java properties: Is there a way a key can include a blank character?

Hi, we are getting properties, we can not influence, out of a database and want to access them by a key/value mapping. We are facing the problem, that one of the property keys includes a blank character. foo bar = barefoot This is - correctly - interpreted as follows key: foo value: bar = barefoot Is there a way to include the bla...