How to check whether all properties of an object are null or empty?

You can do it using Reflection bool IsAnyNullOrEmpty(object myObject) { foreach(PropertyInfo pi in myObject.GetType().GetProperties()) { if(pi.PropertyType == typeof(string)) { string value = (string)pi.GetValue(myObject); if(string.IsNullOrEmpty(value)) { return true; } } } return false; } Matthew Watson suggested an alternative using LINQ: return myObject.GetType().GetProperties() .Where(pi => pi.PropertyType == typeof(string)) .Select(pi => (string)pi.GetValue(myObject)) .Any(value => string.IsNullOrEmpty(value));

How can I access object properties with names like integers or invalid property names?

Updated for PHP 7.2 PHP 7.2 introduced a behavioral change to converting numeric keys in object and array casts, which fixes this particular inconsistency and makes all the following examples behave as expected. One less thing to be confused about! Original answer (applies to versions earlier than 7.2.0) PHP has its share of dark alleys … Read more

Liferay: How to configure Liferay Portal

Liferay properties is powerful instrument that allows us to configure Portal behaviour without coding of hooks-, ext- and theme-plugin. By new requirement we proof at first for possibility to solve this requirement with change of Liferay configuration. The default properties configuration can be found at Liferay source code: https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/portal.properties or in https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/portal.properties or in liferay-bundles\tomcat-7\webapps\ROOT\WEB-INF\lib\portal-impl.jar … Read more

How do I add/update a property inside an MSI from the command-line?

Example VBScript that you could use to update (or add) a property post-build… Option Explicit Const MSI_FILE = “myfile.msi” Dim installer, database, view Set installer = CreateObject(“WindowsInstaller.Installer”) Set database = installer.OpenDatabase (MSI_FILE, 1) ‘ Update Set view = database.OpenView (“UPDATE Property SET Value=”” & myproperty & “” WHERE Property = ‘MYPROPERTY'”) ‘ .. or Add … Read more

Passing variables between view controllers

After performSegueWithIdentifier:sender: your view controler will call – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender assuming your new view controller has some propertys to set: if ([[segue identifier] isEqualToString:@”NextView”]) { MyViewController *myVC = [segue destinationViewController]; myVC.propertyToSet = // set your properties here }