properties

Subversion: how to remove property on commit

My situation is this: I have a Subversion server set up at my home, and we also use Subversion at the company where I work. At work, we use the lock/edit/unlock model (mainly because we are transitioning from Visual SourceSafe and it's easier for the moment). At the moment this is achieved by setting the 'needs-lock' property on all ad...

How To: Dynamically-defined properties in .NET

I've created a couple of Comparer classes for FileInfo objects to allow sorting by Name and LastWriteTime properties, but ideally I'd like to combine them into once class, so that I can compare/sort by any property simply by passing through the chosen property name. However, I don't know how to go about this. My comparer class current i...

Objective-C 101: dot notation and object properties

I have a very basic question regarding properties in Objective-C. I can only access object's properties via dot notation (Obj.MyProp) if I @synthesize myProp. Is that correct? Would it be true to say that if I use my own setter method, I will no longer be able to refer to property in dot notation? Basically I am looking for C# type of...

How to get the numeric value from the Enum?

For example System.Net.HttpStatusCode Enum , i would like to get the HTTP Status Codes instead of the HTTP Status Text System.Net.HttpStatusCode.Forbidden should return 403 instead of "Forbidden" how can i extract the value? ...

UIButton.layer.cornerRadius doesn't exist?

Hi, I'm implementing a custom UIButton with minimal functionality. The .h file: #import <Foundation/Foundation.h> @interface CustomButton : UIButton { } @end I'm encountering a compilation error at line (A) in the .m file: - (id)initWithCoder:(NSCoder *)coder { if(self = [super initWithCoder:coder]) { CALayer *layer = [sel...

Why does a GetType on a string-property result in a NullReferenceException ?

When I call a GetType on a int- or a DateTime-property, I get the expected results, but on a string-property, I get a NullReferenceException (?) : private int PropInt { get; set; } private DateTime PropDate { get; set; } private string propString { get; set; } WriteLine(PropInt.GetType().ToString()); // Result : Syst...

Fields vs Properties for private class variables

For private class variables, which one is preferred? If you have a property like int limit, you want it to be: int Limit {get; set;} and use it inside the class, like so: this.Limit Is there a reason to use it or not use it? Maybe for performance reasons? I wonder if this is a good practice. ...

How do I make my Java application identify itself to Oracle on connection?

When my application connects to an Oracle database I want to be able to see by looking at the active sessions in the database that it is connected. Currently it identifies itself as "JDBC Thin Client" because that's the driver that I'm using, but other Java based applications that I have are somehow able to set this value to something mo...

ASP.NET: How do I access a property of my UserControl, from within JScript?

I need read-access to a user-defined property of my UserControl, from within a <script> element. This script needs to run when the user clicks on the link (which I also don't know how to setup). Thanks for your advice, SO! Code-behind: public partial class TNLink : System.Web.UI.UserControl { [System.ComponentModel.BindableAttrib...

Unnecessary temporary variables when setting property values?

I'm following a book on iPhone development and there is a particular pattern I keep seeing in the example code that doesn't make much sense to me. Whenever a property is set they first assign a pointer to the new value for the property, then set the property to the pointer, then release the pointer. Example: Interface: @interface Doubl...

Properties and Instance Variables in Objective-C

I'm rather confused about properties and instance variables in Objective-C. I'm about half-way through Aaron Hillegass's "Cocoa Programming for Mac OS X" and everything is logical. You would declare a class something like this: @class Something; @interface MyClass : NSObject { NSString *name; NSArray *items; Something *so...

How to get the values of server defined in the settings.xml to use them in my pom.xml?

I know I can retrieve some settings.xml parameters using properties, like, for example ${settings.localRepository} to get the location of the local repository. Now imagine my settings.xml contains the following servers definition: <servers> <server> <id>server-dev</id> <username>devuser</username> <password>devpass</password> <...

In a Property Setter is it Beneficial to only Set if Value Differs?

Hi All, I'm wondering what benefits this code has: private int _TestID; public int TestID { get { return _TestID; } set { if(_TestID != value) { _TestID = value; } } } vs. this: private int _TestID; ...

object parameters in Javascript

I'm having a bit of an issue with my javascript object. What I want to do is pass in an id and have it set a variable that is accessible to all of my functions. Here's a small sample of what I have: var myObject = function() { var pageSize = 6; var currentPage = 1; var pagerPagesVisible = 5; var pagerId = '#my-pager'; ...

Properties file in Eclipse

I have an application that uses a properties file that was added by hand at the /project/bin folder (Eclipse project). The application locates the file using: this.getClass().getClassLoader().getResourceAsStream("filename.properties") Now I want to add this file in Eclipse, so it's actually part of the project. In which directory shou...

Get or Set Accessor of Attached Property not firing on databind? WPF

I have a custom Attached Property but the Accessors on never being accessed on databinding. Are theses accessors meant to be accessed everytime the attached property changes? public static readonly DependencyProperty CharacterColumnNumberProperty = DependencyProperty.RegisterAttached("CharacterColumnNumber", typeof(int), typeo...

Java .properties files as strongly typed classes

Is there way to get properties files as strongly typed classes? I guess there are code generators but doing it with annotations would be much cooler. What I mean is; foo.properties file keyFoo = valuefoo keyBar = valuebar maybe with @properties(file="foo.properties") class foo { } becomes class foo { String getKeyFoo() { } St...

Java Properties Object to String

I have a Java Properties object that I load from an in-memory String, that was previously loaded into memory from the actual .properties file like this: this.propertyFilesCache.put(file, FileUtils.fileToString(propFile)); The util (fileToString) actually reads in the text from the file and the rest of the code stores it in a HashMap (...

Property vs Function (specifically .NET)

I've read some discussions about this subject, and there's something I just don't understand. The most common answer seems to be this: use a ReadOnly Property to return cached data, use a Function to return non-cached data. Don't use a WriteOnly Property at all, cause "it doesn't make sense". There is no performance reason for this. In...

How can I get delegates to property accessors from a generic type?

I'm currently building a node editor (as in Blender) and am having trouble getting delegates to property accessors from a generic type. So far the question here has brought me closest, but I'm having trouble that I think is specifically related to the type of object being generic. For reference, a "Node" is synonymous with an object, an...