Application Skeleton to support multiple screens

Finally created a structure which handle layouts and icon for multiple screen. Android generalises device displays into categories based on two parameters: Screen size, the physical size of the display (measured diagonally) Screen density, the physical pixel density of the display (in pixels-per-inch, or ppi)` To determine screen size & density quickly, please install “What’s … Read more

Detect 7 inch and 10 inch tablet programmatically

You can use the DisplayMetrics to get a whole bunch of information about the screen that your app is running on. First, we create a DisplayMetrics metrics object: DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); From this, we can get the information required to size the display: int widthPixels = metrics.widthPixels; int heightPixels = metrics.heightPixels; This … Read more

Python using basicConfig method to log to console and file

Try this working fine(tested in python 2.7) for both console and file # set up logging to file logging.basicConfig( filename=”log_file_name.log”, level=logging.INFO, format=”[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s – %(message)s”, datefmt=”%H:%M:%S” ) # set up logging to console console = logging.StreamHandler() console.setLevel(logging.DEBUG) # set a format which is simpler for console use formatter = logging.Formatter(‘%(name)-12s: %(levelname)-8s %(message)s’) console.setFormatter(formatter) # … Read more

How to get the size of the current screen in WPF?

I created a little wrapper around the Screen from System.Windows.Forms, currently everything works… Not sure about the “device independent pixels”, though. public class WpfScreen { public static IEnumerable<WpfScreen> AllScreens() { foreach (Screen screen in System.Windows.Forms.Screen.AllScreens) { yield return new WpfScreen(screen); } } public static WpfScreen GetScreenFrom(Window window) { WindowInteropHelper windowInteropHelper = new WindowInteropHelper(window); Screen screen … Read more

What’s dp (density independent pixels) units with CSS?

I disagree with the currently accepted answer. As uber5001 suggests, a px is a fixed unit, and in a similar spirit to the efforts of the Android-specifc dp. Per Material’s spec: When writing CSS, use px wherever dp or sp is stated. Dp only needs to be used in developing for Android. Additionally When designing … Read more

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