Is it more efficient to return a const reference

A function should never return a reference to a local object/variable since such objects go out of the scope and get destroyed when the function returns. Differently, the function can return a const or non const reference to an object whose scope is not limited by the function context. Typical example is a custom operator<<: Unfortunately, returning-by-value has … Read more

What is the best way to profile javascript execution?

Firebug Firebug provides a highly detailed profiling report. It will tell you how long each method invocation takes in a giant (detailed) table. You need to call console.profileEnd () to end your profile block. See the console API here: http://getfirebug.com/wiki/index.php/Console_API Blackbird Blackbird (official site) also has a simpler profiler (can be downloaded from here)

Java check if boolean is null

boolean can only be true or false because it’s a primitive datatype (+ a boolean variables default value is false). You can use the class Boolean instead if you want to use null values. Boolean is a reference type, that’s the reason you can assign null to a Boolean “variable”. Example:

Best way to test if a row exists in a MySQL table

You could also try EXISTS: and per the documentation, you can SELECT anything. Traditionally, an EXISTS subquery starts with SELECT *, but it could begin with SELECT 5 or SELECT column1 or anything at all. MySQL ignores the SELECT list in such a subquery, so it makes no difference.

Make first letter of a string upper case (with maximum performance)

Solution in different C# versions C# 8 with at least .NET Core 3.0 or .NET Standard 2.1 Since .NET Core 3.0 / .NET Standard 2.1 String.Concat() supports ReadonlySpan<char> which saves one allocation if we use .AsSpan(1) instead of .Substring(1). C# 8 C# 7 Really old answers This version is shorter. For a faster solution, take a look at Diego’s answer. Probably the fastest … Read more

Fastest way to remove first char in a String

The second option really isn’t the same as the others – if the string is “///foo” it will become “foo” instead of “//foo”. The first option needs a bit more work to understand than the third – I would view the Substring option as the most common and readable. (Obviously each of them as an individual statement … Read more

ADB stopping at (waiting for devices)

the only reason for this is that your PC is not recognizing Phone.which is a driver problem. You have to understand a few things before starting with the solution. you may know this too. when you are in your recovery adb gets into something like recovery mode(just framing some terms myself) in bootloader, it takes … Read more