What’s the difference between the HTML width / height attribute and the CSS width / height property on the img element?

A hot debate about the subject can be found here: Width attribute for image tag versus CSS To sum it up: The gain from declaring a width value and an height value (which may not be the original physical dimensions of the image) or from css declarations (like width: [valueX]; height: [valueY];) is that it … Read more

A better class to update property files?

It doesn’t get much better than Apache’s Commons Configuration API. This provides a unified approach to configuration from Property files, XML, JNDI, JDBC datasources, etc. It’s handling of property files is very good. It allows you to generate a PropertiesConfigurationLayout object from your property which preserves as much information about your property file as possible … Read more

Property binding vs attribute interpolation

Property binding like [trueValue]=”…” evaluates the expression “…” and assigns the value “true” evaluates to the value true “Y” is unknown. There is no internal Y value in TypeScript and no property in the component class instance, which is the scope of template binding. In this case you would want [trueValue]=”‘Y'” Note the additional quotes … Read more

Objective-C property that is readonly publicly, but has a private setter

I think what you’re looking for are called class extensions. You would declare the property read-only in the header: @interface MyClass : NSObject { } @property (readonly, assign) NSInteger myInteger; @end Then redeclare in your class extension in the implementation file: @interface MyClass () @property (readwrite, assign) NSInteger myInteger; @end @implementation MyClass @end For more … Read more

Checking for null before ToString()

Update 8 years later (wow!) to cover c# 6’s null-conditional operator: var value = maybeNull?.ToString() ?? String.Empty; Other approaches: object defaultValue = “default”; attribs.something = (entry.Properties[“something”].Value ?? defaultValue).ToString() I’ve also used this, which isn’t terribly clever but convenient: public static string ToSafeString(this object obj) { return (obj ?? string.Empty).ToString(); }