Category Archives: Random

Making WordPress Private

Every once in a while, it may be necessary to build a WordPress-powered site only accessible to registered users. Interestingly, a very simple theme hack can take care of this. All you need to do is to include the following PHP code into the current theme so that it is executed before the output begins:

global $user_ID; 
if ($user_ID == '') { 
  header('Location: ' . 
    get_bloginfo('wpurl') . 
    '/wp-login.php?redirect_to=' . 

Generally, a good place to put this code is the header file, although this will ultimately depend on the theme.

Essentially, this snippet checks if the user is logged in and if not, redirects the browser to the login page, while also telling the login page what page the user wanted to retrieve, so that the user could be redirected there after successful login.

A later addition: Sure enough, someone actually created a plugin that addresses this very problem…

Paul Krugman wants to be a songwriter

Paul Krugman writes:

Oh my God. How could I have missed the fact that Suzanne Vega is blogging for the Times?

In my next life I want to be a songwriter — precisely because I can’t imagine how it’s done. I’d give up the whole first page of my Google Scholar listing to have written “The Queen and the Soldier.”

Well, the song may well be worth it:

This particular performance is from the 1997 Das Fest in Karlsruhe.

Eugenics and evolutionary theory

A question from Askville:

Is eugenics rooted in and inspired by evolutionary theory?

The New Oxford American Dictionary defines eugenics as “the science of improving a human population by controlled breeding to increase the occurrence of desirable heritable characteristics. Developed largely by Francis Galton as a method of improving the human race, it fell into disfavor only after the perversion of its doctrines by the Nazis.”

I would say that eugenics is rooted in misunderstanding evolutionary theory…

Evolution theory postulates that only the fittest (meaning, the best adapted to the surrounding environment) survive. Human beings, however, inhabit many natural (and quite a few artificial) environments, so there is no single set of traits that ensures survival in all circumstances. So for the human race to survive, it must remain diverse, if for no other reason, then simply because its habitats are diverse. Eugenicists never understood it…

Of alien life

A question from FunAdvice:

Are we not advanced enough to perceive alien life?

Do you think the reason we can’t find life on the moon, the sun, the 70 sextillion stars, and the decillions of moons and planets that revolve around them is because we are not advanced enough to be able to perceive alien life, just like bacteria is not advanced enough to percieve human life. Maybe all alien life is so advanced that us primitive humans who evolved from monkey’s and have only been advancing for 100 years can’t comprehend civilizations of the moon and Mars, and Venus that are billions of years old and more advanced than us. Maybe they project their world as lifeless on to our eyes so that we won’t invade their planet. Maybe they are holographic images. Bacteria can’t percieve human life, but human life exists. Maybe humans just can’t perceive alein life even though it exists throughout the universe. Any comments or suggestions?

There are all kinds of possibilities…

Maybe space travel is a phase that advanced civilizations outgrow, choosing instead to focus on something more important, such as teaching their children to appreciate the beauty of the world they live in.

Maybe advanced civilizations are impossible in principle, because producing enough energy for interstellar travel would irreparably damage the environment on a planetary scale.

Maybe advanced civilizations can only be built by learning (and evolving) machines floating in outer space close to a star (to draw energy from it), as living beings on planets don’t have enough lifespan to learn what needs to be learned to build an advanced civilization and don’t have enough energy to power their spacecraft.

Maybe there is a Pan-Galactic Pact Against First Contact; all intelligent races agreed to leave the emerging intelligent life alone to evolve as it would (we set up wildlife sanctuaries, why can’t we be in one as well?)

That’s why good science fiction is so much fun; it makes you wonder about these things…

Qualities of a leader

A question from Yahoo! Answers (by Deepak Chopra, no less):

What qualities define a great team leader?

Qualities do not define a team leader; teams and their purposes do.

It is extremely naive to think that leading a team of crusaders to sack Constantinople and leading a team of research scientists to discover a polio vaccine somehow require similar qualities… Speaking of sacking Constantinople, the greatness of this particular achievement was undisputed back when it happened, but was eventually rethought…

The top jobs on the food chain?

A question from Yahoo! Answers:

If there was a chart for the economic food chain what would be the top 10 Jobs?

There are only two, really:

  1. A founder (but not necessarily the CEO) of a successful large company
  2. A heir to #1

Look at Forbes’ list of 24 richest people in the world: almost all fall under #1, except David Thomson (#10), a third-generation heir whose family controls The Thomson Corp. but does little in terms of day-to-day management, Liliane Bettencourt (#12), the heir to L’Oréal founder Eugene Schueller, and three members of Walton family (##22-24), all heirs to Sam Walton of WalMart fame. A few people, such as Lakshmi Mittal (#5), Bernard Arnault (#7) and the Ambani brothers (#14 and #18) are a bit of both; they did inherit a lot of money, but managed to grow it further by expanding family businesses or starting new ones.

An exercise in probability theory

Assume there is a computer manufacturer whose warranty and service plans for a computer selling for $1,739 are priced as follows:

  • 4Yr — $340 or $10/month
  • 3Yr — $260 or $7/month
  • 2Yr — $170 or $5/month
  • 1Yr — $70 or $2/month

All plans include in-home service, parts, labor, and 24×7 phone support (meaning, coverage levels are identical).

Question: what can you infer about the computer’s reliability (as perceived by the manufacturer) from these prices?