properties

Overriding properties in swift

拟墨画扇 提交于 2019-12-31 09:11:31
问题 For example a have a first class public class MyBaseButton: UIButton { public var weight: Double = 1.0 public var text: String? { get { return self.titleForState(.Normal) } set { return self.setTitle(newValue, forState: .Normal) } } } And inherited class: public class SomeButton: SomeBaseButton { override public var text: String? = "text" override public var weight: Double = 2.0 } So, the logic is that SomeClass define own text and weight. But I'm getting an errors: For text : " Cannot

JavaFX distance between two circle and keep updating property

↘锁芯ラ 提交于 2019-12-31 06:57:04
问题 For assignment, I created 2 draggable circle and connect them with line with javaFX. I need add text which calculate distance between two circle (or length of line) and that text need to keep updating when I drag circles, but that's where I stuck Circle circle1 = new Circle(); circle1.setCenterX(40); circle1.setCenterY(40); circle1.setRadius(10); Circle circle2 = new Circle(); circle2.setCenterX(120); circle2.setCenterY(150); circle2.setRadius(10); Line line = new Line (); line.startXProperty

How to make the position of a LINQ Query SELECT variable

穿精又带淫゛_ 提交于 2019-12-31 05:32:04
问题 Is it possible to make the LINQ SELECT more flexible by not working with properties but with the column name? Maybe an example will help..I'm trying to do the following (pseudocode): From x In Entities Where ... Select("ID", "Value" , "Date") but depending on certain choices, I would like to have the result in different order From x In Entities Where ... Select("Value", "Date", "ID" ) Or another amount of SELECT results From x In Entities Where ... Select("Value") Any help to make this as

Java System.getProperty(“user.dir”) on Mac OS X

泪湿孤枕 提交于 2019-12-31 05:19:05
问题 I have an application bundle on Mac OS X 10.4 on the desktop. My application looks for a folder named "resources" in which files to be displayed are kept (kept in the same location as the runnable JAR). I know there is a folder named "Resources" within the app bundle too, sorry if thats confusing, but I never programmed on a Mac and didnt know this would be the same name. In Windows, when I call System.getProperty("user.dir") I get the location at which the runnable JAR file is located.

Private variables which are exposed by properties [closed]

亡梦爱人 提交于 2019-12-31 05:09:11
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . I search some documentation, and tried Xcode and AppCode. But I'm still uncertain about few things. So can somebody clarify me: If I have property named foo, should I have private instance variable named _foo or foo ? If I dont't create a private instance variable, just

unwanted object property changed when changing another object property c#

人走茶凉 提交于 2019-12-31 04:58:07
问题 from what i understand in other posts i know that my objects use same place in memory but how to separate these objects? i tried to use new but it didn't work or i didn't used it correctly. Note that i didnt paste setter and getter here. class Supermarket { List<Product> _products = new List<Product>{ }; List<Customer> _customers = new List<Customer>{ }; } class Customer { List<Product> _purchased= new List<Product>{ }; } class Product { string _id; string _name; DateTime _expireDate; int

Explaning syntax for @property id<delegateName>

我的梦境 提交于 2019-12-31 04:04:08
问题 I see a lot of code references when writing delegates using something likes @property (nonatomic, weak) id<mySuperCoolDelegate> delegate; normally where id<mySuperCoolDelegate> is, is the data type of the property. So the questions are: Is my understanding correct, that above syntax is telling the compiler data type of the id is mySuperCoolDelegate? Any other examples where this sort of code (data type specified for id) could be used? Thanks! 回答1: This syntax tells the compiler that delegate

Powershell: Turn period delimited string into object properties

佐手、 提交于 2019-12-31 03:10:47
问题 I have a string that looks something like this: $string = "property1.property2.property3" And I have an object, we'll call $object . If I try to do $object.$string it doesn't interpret it that I want property3 of property2 of property1 of $object , it thinks I want $object."property1.property2.property3" . Obviously, using split('.') is where I need to be looking, but I don't know how to do it if I have an unknown amount of properties. I can't statically do: $split = $string.split('.')

Getting file properties using a batch file

半腔热情 提交于 2019-12-31 02:34:05
问题 I was wondering if it is possible to get the properties of selected files using a batch file. I only found a winbatch example that was able to do this. Any suggestions are welcome. Thanks 回答1: For standard Windows file properties, use WMIC DATAFILE . Some file formats (for example .mp3 in the ID3 headers) have well known properties. Eventhough some of them might be shown by Explorer, not all of them are available through WMIC DATAFILE. And finally many other document properties in custom file

Use automatically implemented property or implement the property by ourself

牧云@^-^@ 提交于 2019-12-31 01:52:17
问题 In C# we can create a automatically implemented property like that public string MyValue{get;set;} However, we also can create a property by ourself like that private string _myValue; public string MyValue { get { retrun _myValue; } set { _myValue = value; } } My question is in which situation we should use auto one and which situation we should implement ourself? 回答1: There is at least one clear case in which you should NOT use auto-implemented properties: any sort of binary serialization