What’s the best way to dedupe a table?

SELECT DISTINCT <insert all columns but the PK here> FROM foo. Create a temp table using that query (the syntax varies by RDBMS but there’s typically a SELECT … INTO or CREATE TABLE AS pattern available), then blow away the old table and pump the data from the temp table back into it.

How to use Memcached with PHP7?

You need to use the php7 branch; see here, Travis is passing. This should be the complete set of steps to install the memcached extension on a Debian/Ubuntu OS: You may need to change some of the paths if you have them installed at different locations.

C++ performance vs. Java/C#

JIT vs. Static Compiler As already said in the previous posts, JIT can compile IL/bytecode into native code at runtime. The cost of that was mentionned, but not to its conclusion: JIT has one massive problem is that it can’t compile everything: JIT compiling takes time, so the JIT will compile only some parts of … Read more

MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET

As far as I can tell, both syntaxes are equivalent. The first is SQL standard, the second is MySQL’s extension. So they should be exactly equivalent performance wise. http://dev.mysql.com/doc/refman/5.6/en/insert.html says: INSERT inserts new rows into an existing table. The INSERT … VALUES and INSERT … SET forms of the statement insert rows based on explicitly … Read more

How to create a new object instance from a Type

The Activator class within the root System namespace is pretty powerful. There are a lot of overloads for passing parameters to the constructor and such. Check out the documentation at: http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx or (new path) https://docs.microsoft.com/en-us/dotnet/api/system.activator.createinstance Here are some simple examples:

what is ScriptResource.axd in the page load in web app?

You shouldn’t try to remove requests to those handlers without understanding why the requests are being made. A batch of ScriptResource.axd requests like that are usually due to ASP.NET controls registering includes to the scripts that they’re dependent on, especially scripts for the ASP.NET AJAX Control Toolkit controls. If you want to minimize the number … Read more

Fastest way to generate a random boolean

The first option – rand.Next(2) executes behind the scenes the following code: and for the second option – rand.NextDouble(): Since the first option contains maxValue validation, multiplication and casting, the second option is probably faster.