How can I measure pixels in Chrome without an extension?

You could create your own ruler functionality and paste it into the console. Here’s a basic example: var fromX, fromY; var svg = document.createElementNS (‘http://www.w3.org/2000/svg’,”svg”); svg.setAttribute(“style”, “position: absolute; top:0;left:0;height: ” + document.body.clientHeight + “px;width: 100%”); var line = document.createElementNS(‘http://www.w3.org/2000/svg’,’line’); line.setAttribute(“style”, “stroke-width: 4; stroke: red”); svg.appendChild(line); document.body.appendChild(svg); document.body.addEventListener(“mousedown”, function (e) { fromX = e.pageX; fromY = … Read more

What is a bad, decent, good, and excellent F1-measure range?

Consider sklearn.dummy.DummyClassifier(strategy=’uniform’) which is a classifier that make random guesses (a.k.a bad classifier). We can view DummyClassifier as a benchmark to beat, now let’s see it’s f1-score. In a binary classification problem, with balanced dataset: 6198 total sample, 3099 samples labelled as 0 and 3099 samples labelled as 1, f1-score is 0.5 for both classes, … Read more

If I call getMeasuredWidth() or getWidth() for layout in onResume they return 0

You cannot use the width/height/getMeasuredWidth/getMeasuredHeight on a View before the system renders it (typically from onCreate/onResume). Simple solution for this is to post a Runnable to the layout. The runnable will be executed after the View has been laid out. BoxesLayout = (RelativeLayout) findViewById(R.id.BoxesLinearLayout); BoxesLayout.post(new Runnable() { @Override public void run() { int w = … Read more

Why is Graphics.MeasureString() returning a higher than expected number?

From WindowsClient.net: GDI+ adds a small amount (1/6 em) to each end of every string displayed. This 1/6 em allows for glyphs with overhanging ends (such as italic ‘f‘), and also gives GDI+ a small amount of leeway to help with grid fitting expansion. The default action of DrawString will work against you in displaying … Read more

rem px in Javascript

Another method would be to convert rem into pixels: function convertRemToPixels(rem) { return rem * parseFloat(getComputedStyle(document.documentElement).fontSize); } This can be useful when you must perform some arithmetic in js (such as using the position of the mouse to display a tooltip…)

Stopwatch class for Java

The Spring Framework has an excellent StopWatch class: StopWatch stopWatch = new StopWatch(“My Stop Watch”); stopWatch.start(“initializing”); Thread.sleep(2000); // simulated work stopWatch.stop(); stopWatch.start(“processing”); Thread.sleep(5000); // simulated work stopWatch.stop(); stopWatch.start(“finalizing”); Thread.sleep(3000); // simulated work stopWatch.stop(); System.out.println(stopWatch.prettyPrint()); This produces: StopWatch ‘My Stop Watch’: running time (millis) = 10000 —————————————– ms % Task name —————————————– 02000 020% initializing 05000 … Read more

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