Recent News

### Writing a Concurrent Queue

In myprevious note, I discussed about writing a concurrent stack.In this post, I am going to describe writing a non-blocking queue using the Interlocked family of functions like my previous post. However, this time the implementation is in C# (Being an automatically…

### Writing a Concurrent Stack

The stack is one of the most basic data structures and also one of the most widely used. In this post, I am going to take a stab at writing a concurrent stack – one that may be mutated simultaneously by more…

### Young’s Table

A Young’s table is a mxn matrix such that the entries of each row are in sorted order from left to right and the entries in each column are in sorted order from top to bottom. Some of the elements in the…

### Why “OUTPUT THE ANSWER MODULO 10^9 + 7″?

You might have noticed that many programming problems ask you to output the answer “modulo 1000000007 (10^9 + 7)”. In this note I’m going to discuss what this means and the right way to deal with this type of questions. So, here…

### Wilson’s theorem

In number theory, Wilson’s theorem states that a natural number n > 1 is a prime number if and only if((n-1)!) mod n =(n-1)That is, it asserts that the factorial (n – 1)! = 1 * 2 * 3 * ……………*(n –…

### Working with datetime module and timezones in Python

I generally find Python a very versatile language that allows you to do a lot of things without having to expend a lot of effort. However I have run into some issues with the datetime module.For basic purpose the datetime module is…

### Writing a C program without a main()

This post is a simple example of deception. It shows how a programmer can defy the very important rule of having a main() in c program and still make the program run. This illustrates the concept on a simple program though it…

### void pointer in C

A void pointer is a pointer that has no associated data type with it. A void pointer can hold address of any type and can be typcasted to any type.int a = 10; char b = ‘x’; void *p = &a; //…

### Want to make Rails hosting faster than ever?

The gemzeusdoes exactly this.The commandrails serveroften takes too long to start up a simple WEBrick server. And in case something major changes in your application, you often have to restart the server.After installing the gem zeus, we can do all of this…

### What happens when you press a key on keyboard

Below step by step execution will happen when we pressed a key on the keyboard:-1) The keyboard sends a scan code of the key to the keyboard controller (Scan code for key pressed and key released is different)2) The keyboard controller interprets…