Welcome ! This is the personal site / blog of Graham King. Most people come for the credit card generator, but I think the Categories (top right) are more interesting.
The Brain That Changes Itself, by Norman Doidge is a fascinating book about brain plasticity, the ability of our brain to re-wire itself to cope with changing conditions. In a chapter about culture’s influence on our brain maps, he says:
Television watching, one of the signature activities of our culture, correlates with brain problems.
Monit tells you if something goes wrong on your server, and tries to fix it. It can, for example, alert you:
When a process dies.
When a machine stops responding to network requests
When your machine has too high load average, memory consumption, or CPU usage.
When a file changes, hasn’t changed for a period of time, or grows beyond a certain size.
It can run a script of your choosing to attempt to fix the problem. It has an HTTP interface that shows you essential stats about the services you are monitoring. For detailed graphs, I recommend Munin.
Here are my notes from setting it up, they are brief, but should help you get going.
All the monitored machines run a small daemon called munin-node. One machine is the central server. Every few minutes it gathers data from all the nodes (including itself), generates the graphs, and writes out some HTML files.
If your MySQL (5.0+) replication is broken, there’s two ways to fix it: The easy way, and the right way.
Run commands starting with $ on Unix. Run commands starting with mysql> in the MySQL client.
The easy way: Skip the problem
If you hit both databases at the same time, with the same INSERT, they will create their own record, and try and replicate to the other, which already has that record, causing a duplicate error.
In a simple case like that, you just want to skip the offending statement:
Most of the time, you skip one statement, and replication breaks again straight away, because there’s a whole queue of problem statements coming up.
The right way: Rebuild
If you are not sure that you can skip the duplicate, or if replication has been broken long enough that your two servers are out of synch, pick one database to be the master, and rebuild the other from a copy of that master.
My short notes on Predictably Irrational, by Dan Ariely. An excellent book. Entertaining, and covers much fascinating ground from social psychology and behavioral economics. Some of the experiments Dan and his team designed are fiendish!
Value is relative
We only know what we want when we see it in context. The bike the Tour de France winner rides. A set of speakers compared to another.
We only know what something is worth, or how much we like it, when comparing to other similar things (purchases, partners, jobs, etc..
We tend to choose the middle option. A high price option on a restaurant menu increases average order price, because it makes the rest seem cheap in comparison.
As an Amazon reviews says, “arguably the best book ever on what is increasingly becoming the science of persuasion.”
If you want to understand why you felt compelled to give money to a Hare Krishna devotee, how car salesman or realtor’s work, and much more, you should read this.
It’s also a very easy and enjoyable read. These are my notes. They cover all the content in the book, but don’t link to research. In the book, most of the statements have links to research papers to back them up.
We can process incoming information cognitively in one of two ways:
Controlled responding, which is subjecting information to a thorough analysis. This is when we think a problem through, research it, etc. We only do this if we have the desire and the ability. It is intellectually taxing and time consuming.
Use judgmental heuristics such as:
Price as surrogate for value. Applies particularly to items which are hard to value: Wine, jewelry, art, employee salaries, etc.
Trust experts. This is why pseudo-science books always have ‘PhD’ or ‘MD’ after the author’s name.
Because – we want reasons to do something, even bogus ones.
By Thomas Gilovich, social psychologist and CSI Fellow, this well written book explains some of the reasoning and deduction errors we make when trying to understand the world, and ways to avoid making those errors.
This is an easy and engaging read, and offers several straightforward techniques to avoid making common reasoning errors. I recommend you look up How We Know What Isn’t So: The Fallibility of Human Reason in Everyday Life
in your local library, or get it second-hand from Amazon for less than a posh cup of coffee.
These are my notes / summary of the book.
I. Cognitive determinants of belief
2. Something out of nothing: The mis-perception and misinterpretation of random data
We are predisposed to see order, pattern, and meaning in the world, and we find randomness, chaos, and meaninglessness unsatisfying.
As a consequence we tend to ’see’ order where there is none, and we spot meaningful patterns where only the vagrancies of chance are operating.
In the general case, there is no way to list all the keys that a memcached instance is storing. You can, however, list something like the first 1Meg of keys, which is usually enough during development. Here’s how:
I recently received an advert for an investment fund in which, as the amateur social psychologist that I am, I noticed illustrated a couple of psychological principles. The are both covered in the email title:
Last chance to invest in a firm favourite
They are covered again in more detail in this paragraph:
The x y z Fund only launched six months ago, but has already attracted considerable interest. To keep it small and flexible the number of units has been capped at 200 million. Last week they had reached two-thirds of that total and interest is intensifying. In the last two days alone they sold over 6 million units, so it is likely to close very soon.
More and more, my web apps need to run things in the background: Sending email, re-calculating values, fetching website thumbnails, etc. In short, I need a message queue in my toolbox.
In response to monkeys stealing his coffee beans, an Indian farmer observes: If you start shooting monkeys, you’ll spend the rest of your life shooting monkeys.
in a survey of 1,506 people last year by Nationwide Mutual Insurance, 81 percent of cellphone owners acknowledged that they talk on phones while driving, and 98 percent considered themselves safe drivers. But 45 percent said they had been hit or nearly hit by a driver talking on a phone.
That’s the Lake Wobegon effect, the tendency for overestimate their capabilities in relation to others.
I setup my Mercurial repository in the same way we used to do CVS, then SVN: A directory owned by a group, with the GUID bit, and all users who need to commit are in that group.
The steps are, create the group and add relevant users to it:
:noclick
sudo groupadd topsecretgroup
sudo usermod -a -G topsecretgroup graham
The cooking instructions for my Tandoori Chicken Breast microwave lunch, are to cook…
…until internal temperature reaches 74C (165F).
How many office kitchens have a cook’s thermometer? Score nothing for usability.
Should you for any reason attempt to sue the manufacturer, it will rapidly become apparent that you didn’t follow the cooking instructions. Score one for legal.