Which is best way to define constants in android, either static class, interface or xml resource?

There is a big difference between the two in that you can reference project resources in your XML layouts. They are available in the application context and are therefore accessible across the global application. The biggest advantages of using project resources is the ease of access and that they allow you to organize your project … Read more

Error message Strict standards: Non-static method should not be called statically in php

Your methods are missing the static keyword. Change function getInstanceByName($name=””){ to public static function getInstanceByName($name=””){ if you want to call them statically. Note that static methods (and Singletons) are death to testability. Also note that you are doing way too much work in the constructor, especially all that querying shouldn’t be in there. All your … Read more

How to initialize static variables

PHP can’t parse non-trivial expressions in initializers. I prefer to work around this by adding code right after definition of the class: class Foo { static $bar; } Foo::$bar = array(…); or class Foo { private static $bar; static function init() { self::$bar = array(…); } } Foo::init(); PHP 5.6 can handle some expressions now. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)