Steps to optimize WordPress in regard to server load and website speed?

You could install WordPress on Nginx. There are a number of resources to help: nginx Compatibility plugin HOWTO: Install WordPress On Nginx– Slicehost discussion How To Speed Up WordPress With Nginx And WP Super Cache WordPress on nginx + lighttpd + FastCGI + php Nginx as a front-end proxy cache for WordPress Some performance information … Read more

Fastest way to put contents of Set to a single String with words separated by a whitespace?

With commons/lang you can do this using StringUtils.join: You can’t really beat that for brevity. Update: Re-reading this answer, I would prefer the other answer regarding Guava’s Joiner now. In fact, these days I don’t go near apache commons. Another Update: Java 8 introduced the method String.join() While this isn’t as flexible as the Guava version, it’s handy when … Read more

Image rotation algorithm

One of the best pages describing image rotation algorithms I’ve found on the internet is tied to Dan Bloomberg’s excellent leptonica library. While the leptonica library itself is written in C and won’t help you, his page on image rotation algorithms: http://www.leptonica.org/rotation.html is definitely worth a read. You will most likely want to implement something … Read more

Most efficient way to increment a Map value in Java

Some test results I’ve gotten a lot of good answers to this question–thanks folks–so I decided to run some tests and figure out which method is actually fastest. The five methods I tested are these: the “ContainsKey” method that I presented in the question the “TestForNull” method suggested by Aleksandar Dimitrov the “AtomicLong” method suggested … Read more

Why is Fetch task in Hive works faster than Map-only task?

FetchTask directly fetches data, whereas Mapreduce will invoke a map reduce job  Run code snippetExpand snippet Also there is another parameter hive.fetch.task.conversion.threshold which by default in 0.10-0.13 is -1 and >0.14 is 1G(1073741824) This indicates that, If table size is greater than 1G use Mapreduce instead of Fetch task more detail

Big O, how do you calculate/approximate it?

I’ll do my best to explain it here on simple terms, but be warned that this topic takes my students a couple of months to finally grasp. You can find more information on the Chapter 2 of the Data Structures and Algorithms in Java book. There is no mechanical procedure that can be used to get the BigOh. As … Read more

How to efficiently remove duplicates from an array without using Set

Since this question is still getting a lot of attention, I decided to answer it by copying this answer from Code Review.SE: You’re following the same philosophy as the bubble sort, which is very, very, very slow. Have you tried this?: Sort your unordered array with quicksort. Quicksort is much faster than bubble sort (I know, you … Read more

How can you profile a Python script?

Python includes a profiler called cProfile. It not only gives the total running time, but also times each function separately, and tells you how many times each function was called, making it easy to determine where you should make optimizations. You can call it from within your code, or from the interpreter, like this: Even more … Read more