Setting background colour of Android layout element

You can use simple color resources, specified usually inside res/values/colors.xml. <color name=”red”>#ffff0000</color> and use this via android:background=”@color/red”. This color can be used anywhere else too, e.g. as a text color. Reference it in XML the same way, or get it in code via getResources().getColor(R.color.red). You can also use any drawable resource as a background, use … Read more

Hide traceback unless a debug flag is set

The short way is using the sys module and use this command: sys.tracebacklimit = 0 Use your flag to determine the behaviour. Example: >>> import sys >>> sys.tracebacklimit=0 >>> int(‘a’) ValueError: invalid literal for int() with base 10: ‘a’ The nicer way is to use and exception hook: def exception_handler(exception_type, exception, traceback): # All your … Read more

Display attribute ‘Title’ of element/s in other element on Focus or Click

one of the possible solutions JSFiddle: $(document).on(‘mouseenter’, ‘input,select’, function (e) { $(‘#current-control-label’).text($(this).data().title); }); $(document).on(‘mouseleave’, ‘input,select’, function (e) { $(‘#current-control-label’).text(‘ ‘); }); html: <table> <tr> <td><input type=”text” data-title=”Name” /></td> <td> <select data-title=”Gender”> <option value=”M”>Male</option> <option value=”M”>Female</option> </select> </td> <td><input type=”radio” data-title=”Active” /></td> </tr> <tr> <td colspan=”2″> <span id=”current-control-label”>&nbsp;</span> </td> </tr> </table>