You Are Here Home > Fun

Fun

Why Did They Call Them Minutes And Seconds?

The reason was that they thought the unit was so ‘minute’ (small) and so the word minute stuck and when they further divided a minute into 60 parts, the new parts were of ‘second’ order of minuteness and over time they called the seconds…

Why Did They Call Them Minutes And Seconds?
Comments (0)   Filed under: Fun,General   Posted by: Hamid

Basic threading in JavaScript; JavaScript Worker Threads

I was searching the web yesterday for this and didn’t really find a simple way of doing this and suddenly, I remembered something.

It’s extremely simple, someone could build on it with all sorts of features but for now, here is an example:
http://images.code-head.com/code/javascript/js-threads.html

As you can see there are two counters, one is counting up and the other down simultaneously.

Here is the start_thread function:

function thread_start(callback) {
   setTimeout(callback, 1);
   return true;
}

The trick is that setTimeout *does not* block the execution and starts another thread to run the callback function :)

I hope this helps someone :)

Basic threading in JavaScript; JavaScript Worker Threads
Comments (5)   Filed under: Fun,General,JavaScript,jQuery,Programming   Posted by: Hamid
« Newer PostsOlder Posts »