Yes, it is possible to disable the text selection with a simple line of CSS. The user-select property is a new CSS3 property. Using user-select enables web and app developers to control the ability to select text. Most browsers (With CSS3 support), can do this by using variations on the CSS3 user-select property. The user-select ..

Read more

In Java there is a easy was to capture screenshots. The following captureScreenshot method will capture a screenshot of the display of your screen and save it to the disk. public void captureScreenshot(String filename) throws Exception { java.awt.Dimension size = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); java.awt.Rectangle rectangle = new java.awt.Rectangle(size); java.awt.Robot robot = new java.awt.Robot(); java.awt.image.BufferedImage image = robot.createScreenCapture(rectangle); ..

Read more

There is a simple solution, to get the name of the current method in Java. It uses the stack trace to get the name of the mehod. It works with different virtual machines like oracle, dalvik (Android), Open JDK, etc. String name = Thread.currentThread().getStackTrace()[1].getMethodName(); But don’t use this in time-critical code, because working with the ..

Read more

To generate random readable passwords you can combine words, letters and special chars. The words can come from a wordlist array. For example you can use the list of the 10,000 most common English words in order of frequency, as determined by n-gram frequency analysis of the Google’s Trillion Word Corpus. In the exmaple the ..

Read more

This is a simple Android background Service Template. You can use it to run updates in the background without blocking the UI. To start and stop the service use the following lines in your activity: // starting the service Intent intent = new Intent(this, UpdateService .class); startService(intent); // stopping the service Intent intent = new ..

Read more

If you play around with height and width for a android device you often need to convert between real pixel (px) and device indipenden pixel (dp, dip). The following methods are a easy solution to convert between px to dp private float px2Dp(float px, Context ctx) { return px / ctx.getResources().getDisplayMetrics().density; } private float dp2Px(float ..

Read more