Category Archives: Talk

Talk about politics, society, science, computers, internet, psychology, and philosophy.

The Selfish Gene

Richard Dawkins discusses in his book “The Selfish Gene” if we are using our genes to propagate ourselves, or if maybe our genes are using us to propagate themselves.

According to Dawkins life may very well have begun a long time ago, in the primordial soup, when simple clumps of amino-acids became self-replicating. This self-replication started a kind of war between competing replicators and who was on top (or in the majority) in the soup probably changed many times until one kind of replicators using a protective layer of matter came out the winner (one cell organisms).

Continue reading The Selfish Gene

How to add a body on load function with Javascript

This is an article on how to add a javascript function that will be run when a web page has loaded. We begin by defining a function for running after a page (or actually window) has been loaded:

function bodyOnLoad() {

And then we’ll do:

window.onload = bodyOnLoad;

However, we also want to make sure our setting of the load event doesn’t remove some other setting. This is done by also keeping any older events.

We store the previous on load event by doing;

var prevOnLoad = window.onload;

And we redefine our bodyOnLoad function:

function bodyOnLoad() {

However, we can make the creation of the function and the setting of the event a little bit more effective by doing:

window.onload = function() {


You still need to get prevOnLoad before you do that

This becomes even more obvious once we create a function for adding new load events:

function addLoadEvent(func) {
  var prevOnLoad = window.onload;
  window.onload = function() {

In this way, we can concentrate on creating the new load event outside of the function for adding it to the window.onload.

function myEvent(){

We might even do:

  function (){

Notice the difference between curly braces “{}” and parenthesis “()”

Finally, we have to make sure there is a load event set for the window before calling it from the new event, so we need to check for this:

function addLoadEvent(func) {
  var prevOnLoad = window.onload;
  if (typeof prevOnLoad != 'function') {
    window.onload = func;
  else {
    window.onload = function() {

Programming humor

In case you wondered. Sure, programming can be humorous, but this is more about looking at programming with humor. Or, well, I’ve found a few funny things I’d like to share… XML is like violence: if it doesn’t solve your problem, you’re not using enough of it.

People who make buttumptions about their censoring settings, will be embarbutted when they repeat this clbuttic mistake.

Review: Paycheck – Let the future be untold (4/5)

Paycheck (IMDB, Amazon) is a story about Michael Jennings (Ben Affleck) who is an engineer, or to be more precise a reverse engineer. Michael is paid to take competitor’s work and reverse engineer it into something his employees can make into a products of their own.

Since it would be very bad if information about whose technology was reverse engineered into what, Michael’s assistant Shorty (Paul Giamatti) helps removing all of Michael’s memories of the project once work is finished.

A once in a lifetime opportunity comes along as Michael’s old friend Rethrick (Aaron Eckhart) offers him work that will give him stocks in Rethrick’s promised-to-become-great company. Michael takes on the three year project, even if he risks losing his memory for the whole period, and that of a probably blooming romance with one of Rethrick’s employees, doctor in biochemistry, Rachel Porter (Uma Thurman).

Three years passes, Michael finds himself back where he once begun, in Rethrick’s office, his memory wiped and all that stands between him and his millions, a trip to the bank.

That is however, when problem starts, because Michael finds not only has he switched the personal effects he once had to leave before entering Rethrick’s employee, he has also forfeited a 100 million dollars worth of stocks in Rethrick’s company.

Why did Michael say no to the money and, of significantly less importance, what became of his personal effects? Michael soon realizes his former employees and the FBI are out to get him, and his bag of assorted effects seems to be the only thing that keeps him ahead of the game. A game, that if lost, could cost him his life…

You can read the whole review by clicking the below link, but there may be spoilers in that text…

Continue reading Review: Paycheck – Let the future be untold (4/5)

Programming booleans

When looking at other programmer’s code I’m sometimes surprised with things like this:

exportDocumentView(java.lang.String absPath, out,
boolean skipBinary, boolean noRecurse)

And in such prominent frameworks as Java Content Repository as well.

What’s my problem then? Double negations. In order to do exportDocumentView and get binary data and recursive export you’ll need to do:

exportDocumentView(“/path/to/my/Node/”, System.out, false, false)

Sure I can handle it… but… false to opt something in? I find it rather fishy. Call me an idiot but my brain just don’t deal with that kind of stuff easily…

What I would have wanted instead was:

exportDocumentView(java.lang.String absPath, out,
boolean includeBinary, boolean recursive)

Which would have been called like:

exportDocumentView(“/path/to/my/Node/”, System.out, true, true)

For when we want binary data and recursive export, and like this for the case when we don’t want either or both:

exportDocumentView(“/path/to/my/Node/”, System.out, false, true)
exportDocumentView(“/path/to/my/Node/”, System.out, true, false)
exportDocumentView(“/path/to/my/Node/”, System.out, false, false)

I’m just saying. In my world false means “no” and “no” means don’t give me something or don’t do something:

“Don’t return binary data.”
“Don’t recurse the tree of nodes.”

To be compared with:

“Don’t skip binary data.”
“Don’t do no recursing.”

(But you’re free to curse? :o)

He heard her own gasp of astonishment

I just read the following sentence:

“He heard her own gasp of astonishment”

Some words just don’t work well with things no one else can do for you, I mean…

I entered the room and guess if I was surprised. My neighbor gasped with my astonishment, and as he had one of my thoughts, he came over to my own apartment to have a talk with me. He told me, with his wife’s voice, he disliked all but his own ideas. I had one of his ideas and in a contrary to his position, decided I liked it, so I made it my own idea.

It could get pretty interesting after a while of that. Perhaps the next pop-style of writing…?

Review: Ultraviolet – Xenophobia (3/5)

Ultraviolet (IMDB, Amazon) is a story about Violet, an ordinary woman whose life changed when she was infected by a virus that turned her into a feared and hated hemophage.

Once contracting hemophagia, Violet was incarcerated and experimented on, and perhaps these experiments cost her the child she was bearing when infected, perhaps the infection itself did, regardless, Violet escaped and now she is out to steal the government’s latest and most deadly weapon in the fight against hemophages.

The hemophages have superhuman strength and speed, but at a cost; few live longer than a decade. Since the virus that causes hemophagism infect on blood contact, the number of hemophages should have grown had it not been for the government’s prosecution.

Like vampires the hemophages have pointy eyeteeth, but unlike the vampires they do not require sucking blood and taking lives to survive. They are far from demons, and rather unfortunates infected by a deadly and infectious disease, and the only demon thing about them is the demonizing of them done by the government.

You can read the whole review by clicking the below link, but there may be spoilers in that text…

Continue reading Review: Ultraviolet – Xenophobia (3/5)

DVDs catching up?

Once upon a time a CD was large. Huge. You used it to save lots and lots of data.

Then came MP3s, movies, digital cameras with millions of pixels and suddenly the CD was small. And the DVD came, and for a while it was large… I don’t think it ever was huge.

Today I would have to use more than 300 4.4 GB DVDs to save all my data, and that only includes the data on hard drives. Making back-ups becomes a question of selecting what to back-up and what to leave for chance. A real pain.

But there might be light at the end of the tunnel.

Researches at the Technical University of Berlin claims they’ve managed to put up to 500 GB of data on a CD/DVD-sized disc

This is (layman’s interpretation) done by using holograms. The disc is transparent (wonder how that will work with labeling?) and uses ten layers of data (to compare with blu-rays that use two, and ordinary DVDs that use one). Anyway, sometime around 2010 they might be able to fit as much as 1 Terabyte to a CD-sized disc.

That’s probably the same time as hard drives comes in 10-20 Terabyte sizes, and soon after the 1TB DVD will once more be insufficient.


Evolution — a guessing game…

Does evolution really work? Has it really made us what we are today? Surely the chance of just randomly creating human life must be “zero many times over”, right?

I’ve read quite a few pages from the more fundamental and lively bunch of Creationists and Intelligent Design aficionados (like for instance this one), and I’ve frankly grown tired of this talk about randomly creating life…

Continue reading Evolution — a guessing game…

Using UUIDs to Prevent Broken Links

I don’t know if someone has proposed this before, but how about using UUIDs to prevent broken links?

A UUID, Universally Unique Identifier, is a hexadecimal number divided into five sections. A UUID has the special quality that it is universally unique. This means two people on each side of the world could create a UUID each at the exact same time, and still be sure their UUIDs are not identical. In fact they can create a large number of UUIDs and still be sure they are not identical. (The same goes for two people on the same server.)

This quality makes UUIDs a perfect tool for assigning unique IDs to web pages or other Internet resources (in fact any resource of any kind, your dog, the cuttlery in your drawers, you name it.)

This could be done like this:

Step 1: Place the UUID on the page

First a UUID has to be put on the webpage, perhaps with a meta-tag, or with plain text on the page.

With a meta tag it could be done like:

<meta name=”UUID” content=”8523813a-7c47-4cd9-ad78-09c14dfb505f”/>

Or on the page, like:

UUID: 8523813a-7c47-4cd9-ad78-09c14dfb505f

Step 2: Find the UUID

The second step would be to make sure every time a program stores a URL to the page it also stores the UUID. (When creating bookmarks, or linking from one site to another etc).

So, once the page get lost, either because the link has changed, the page has been moved or something similar, the browser (or site) can use the UUID to find the page again.

The second step obviously demands a search engine (or some other central registry) that utilizes UUIDs in it’s index since the system does require some kind of central processing for keeping track of a UUID-to-page-link.

A UUID is not a particularly good URI since even UUIDs generated at the same host just a few seconds apart are still totally different from each others (this actually depends on implementation, but one should not assume UUIDs from the same host shares any similarities).

This however is also one of the strengths of UUIDs since it means an Internet resource should be possible to locate regardless of its physical location (in a contrary to ordinary http-URLs that are tightly bound to their location — they start with the server name).

Since a UUID (per definition) is universally unique, it is fairly simple to generate one wherever you are, and use it in a page, be sure there are no duplicates and locate the exact page of the UUID again.

A Google experiment

I’ve placed the text “UUID: 8523813a-7c47-4cd9-ad78-09c14dfb505f” on this page. (Several times now). As far as I’ve been able to discern, Google indexes even such arbitrary information as UUID data (the exact string “8523813a-7c47-4cd9-ad78-09c14dfb505f” to be precise, check out this page with a discussion on how to use UUIDs to make pages unique… It has nothing to do with this discussion but is an interesting example on how UUIDs could be used with Google).

By searching for “8523813a-7c47-4cd9-ad78-09c14dfb505f” it should be possible to locate this page… (see if it works? — Give Google time to index the page though… Update: the above link seems to not work, but this one [searching for the UUID with “-” replaced to space — or “+”], however, does…)


The page localization should work regardless of the page’s position, site, or anything. In fact, as long as the UUID is still there, it should even be possible to place this text in a document of type Word/OpenDocument/PDF or any other format a search engine can index, and the text would still be possible to find with nothing but the UUID.

Obviously the end result of this technology would be that there is no “search-engine-in-between” but instead whenever the link is lost, the caller goes to the central repository/search engine (or some other place) and locate the page, then links to it automatically. It should even be smart enough to retry until it finds a link that works if a UUID has several possible links.