HipHop VM on EC2 – “could not allocate 1210089471 bytes for translation cache”
Facebook Engineering recently made a press release regarding the HipHop project, HHVM is finally faster than the hiphop compiler. They also made a post about how to get WordPress running on HipHop Virtual Machine! This is a pretty big deal, after all, it’s estimated that over 20% of the sites on the web today are actually WordPress installations. It has…
Little-Known Awesome Algorithms: O(N+K) Sorting — Counting Sort
Counting Sort, an O(N+K) sorting algorithm
Recently I came across a sorting method that I wasn’t taught back when I took my algorithms course in school. That algorithm is called ‘counting sort’. The idea behind counting sort is that if the number of distinct elements in our data-set is significantly smaller than the total number of elements in the data-set…
How to program a Gaussian Blur without using 3rd party libraries
What is a Gaussian Blur?
Something I found fairly difficult to find online was a simple explanation on how to implement my own Gaussian Blur function. This article will explain how to implement one.
The basic idea behind a Gaussian Blur is that each pixel becomes the average of the pixels around it, sort of. Instead of simply taking the…
How a Scam Artist Can Use Divide and Conquer for Confidence Scamming
I heard about this interesting trick last week regarding how someone managed to scam hundreds of people out of money. (Not that I condone scamming, it’s just very clever!) Supposedly this happened in the 80′s with regular old snail mail. I can’t find a source for this so if someone can comment with one, that would be really great.
1)…
Zeckendorf’s Theorem & Simple Code Implementation
Zeckendorf’s theorem says that every positive integer can be represented as the sum of non-consecutive Fibonacci integers and that such a representation is unique.
For example:
100 = 89 + 8 + 3
10,000 = 6765 + 2584 + 610 +34 + 5 + 2
Notice though that there are many ways to represent an integer as the sum of…
Little-Known Awesome Algorithms: Adversary Discovery
Contrived Use-Case
Imagine you have a group of N people and you want all of them to know your secrets. The problem is that not everyone is trust-worthy, in fact, let’s estimate that K of them are not trust-worthy. How can you discover which of these people are the snitches or trouble-causing ones so you can exclude them from your…
SPOJ Problem 7974: What’s Next – ACPC10A
In this problem, we are given three numbers which make up either an arithmetic sequence or a geometric sequence. We have to figure out what type of sequence the numbers make and then give the next number.
First, let’s define an arithmetic sequence: an arithmetic sequence is a sequence of numbers such that the difference between each pair of consecutive…
Hotmail deletes old accounts — Allowing others to hijack your identity
One thing I don’t quite understand is why Microsoft Hotmail, now known as Outlook, decided it would be a good idea to delete old inactive email accounts. About 5 years ago, about the time when Gmail really got huge, I abandoned my Hotmail account which happened to be tied to quite a few websites. Since Hotmail has since deleted the…
C++11 Standard — What are Smart Pointers good for?
What is a shared_ptr?
A common problem in larger C++ projects is memory management. When a pointer is being passed from function to function, who has the responsibility of deleting the data at the end? I suppose you can come up with a few rules that can be followed to help manage this sort of delegation, but to solve this…
Difficult Amazon interview question — Find all phrases you can build, given a set of letters.
Recently I had an interview at Amazon where we only had 20 minutes left to solve one more problem. The interviewer brought up the following problem:
“Are you familiar with anagrams? Take your name, “Rodrigo Salazar” and rearrange the letters in your name to make a new phrase, print out every possible phrase.”
For example, you can rearrange the letters…