Monthly Archives: January 2011

Funny Mathematics Series

Have you seen these Mathematics Series before?

Are you smart mathematician?

Here we go, funny mathematics series …

1 x 8 + 1 = 9
12 x 8 + 2 = 98
123 x 8 + 3 = 987
1234 x 8 + 4 = 9876
12345 x 8 + 5 = 98765
123456 x 8 + 6 = 987654
1234567 x 8 + 7 = 9876543
12345678 x 8 + 8 = 98765432
123456789 x 8 + 9 = 987654321

9 x 9 + 7 = 88
98 x 9 + 6 = 888
987 x 9 + 5 = 8888
9876 x 9 + 4 = 88888
98765 x 9 + 3 = 888888
987654 x 9 + 2 = 8888888
9876543 x 9 + 1 = 88888888
98765432 x 9 + 0 = 888888888

1 x 9 + 2 = 11
12 x 9 + 3 = 111
123 x 9 + 4 = 1111
1234 x 9 + 5 = 11111
12345 x 9 + 6 = 111111
123456 x 9 + 7 = 1111111
1234567 x 9 + 8 = 11111111
12345678 x 9 + 9 = 111111111
123456789 x 9 +10= 1111111111

Using C#.Net Create Zip File

From C# code, files can be easily compressed in Zip format by getting the advantage of  Zip functionality available in J#. First of all we have to add reference of the J# .NET library in our project. Physically, it resides as a file named vjslib.dll

Add Reference vjslib (J# .Net Library):

In Solution Explorer Right click your project on References and click on “Add Reference” -> select the .NET tab -> scroll down and select “vjslib” -> click OK.
After adding reference, the Java library classes could be refered  within your application.

C# Code:

using java.util;

 private void CreateZipFile(string DestinationZipFileName, string SourceFileToZip)

 FileOutputStream fileOutStream;
 fileOutStream = new FileOutputStream(DestinationZipFileName);
 ZipOutputStream zipOutStream ;
 zipOutStream = new ZipOutputStream(fileOutStream);

 FileInputStream fileInStream ;
 fileInStream = new FileInputStream(SourceFileToZip);

 ZipEntry zipEntry;
 zipEntry = new ZipEntry(Path.GetFileName(SourceFileToZip));


 sbyte[] buffer = new sbyte[1024];
 int len = 0;
 while ((len = >= 0)
 zipOutStream.write(buffer, 0, len);



I hope this simple example will help you a lot.

Play Audio Files with SoundPlayer Class

Here is simplest way to play Audio Files and System Sounds with SoundPlayer class in .Net

//Namespace:  System.Media
//Assembly:  System (in System.dll)

using System.Media;

// Create an instance of the SoundPlayer class and attaches the specified .wav file

SoundPlayer soundplayer= new SoundPlayer("audio file path");

// Load the .wav file.

//Check if loading of a .wav file has successfully completed.

if (soundplayer.IsLoadCompleted)

//plays the selected .wav file


// play system sounds

NOTE: The SoundPlayer class cannot play other file types, such as .wma or .mp3. If you want to play other file types, you can use the Windows Media Player control. For more information, see Using the Windows Media Player Control in a .NET Framework Solution and Windows Media Player Object Model Reference for Visual Basic .NET and C# in the Windows Media Player SDK.

Add Custom Key tag in web.config / aap.config appSettings

Very often it is required to add custom tags or key in app.config or in web.config. Here is a simple way to add key in <appSettings> and then access it.

Find section <appSettings> or <appSettings/> in .config file and add your required keys and values, the following example is same for both  .config files. here we go

An appSettings element in the root Web.config / App.config file that looks like the following:


<add key=myKeyNamevalue=my custom setting value/>


The <appSettings> element is a direct child of the <configuration> element and a peer of the system.web element.

Values read from the appSettings element of the .config file are always of type String. If the specified key does not exist in the .config file, no error occurs. Instead, an empty string is returned

C# Code:

using System.Collections.Specialized;

using System.Configuration;

string strKeysAndValues = "";

// get all keys and values in AppSettings element

NameValueCollection sAll = ConfigurationManager.AppSettings;

foreach (string s in sAll.AllKeys)


 strKeysAndValues += "Key" + s + " value:"+ sAll.Get(s)+" ";



string strKeysAndValues= ConfigurationSettings.AppSettings["myKeyName"].ToString();

World’s Ever Simplest Example to Understand Thread Pool

1. Step

//creating class that contain method which would be used for threads start method

class ContaingThreadStartMethod{

private ManualResetEvent _doneEvent;

public ContaingThreadStartMethod(ManualResetEvent doneEvent)


_doneEvent = doneEvent;


public void StartMethod(object obj){


int i = (int)obj;


catch (Exception ex)


string error_msg = ex.message;








2. Step

//Creating threads and

//maintain thread pool

ThreadCount = 20; // threads to be initiated

int number = 1; // object to be passed for manupulation

ManualResetEvent[] doneEvents = new ManualResetEvent[ThreadCount];

for (int i = 0; i &lt; ThreadCount; i++)


doneEvents[i] = new ManualResetEvent(false);

ContaingThreadStartMethod ctsm = new ContaingThreadStartMethod(doneEvents[i]);

ThreadPool.QueueUserWorkItem(ctsm.StartMethod, number);


// Wait for all threads in pool to calculation…



Knowing where to tap

A giant ship engine failed. The ship’s owners tried one expert after another, but none of them could figure but how to fix the engine.

Then they brought in an old man who had been fixing ships since he was a young. He carried a large bag of tools with him, and when he arrived, he immediately went to work. He inspected the engine very carefully, top to bottom.

Two of the ship’s owners were there, watching this man, hoping he would know what to do. After looking things over, the old man reached into his bag and pulled out a small hammer. He gently tapped something. Instantly, the engine lurched into life. He carefully put his hammer away. The engine was fixed!

A week later, the owners received a bill from the old man for ten thousand dollars.

“What?!” the owners exclaimed. “He hardly did anything!”

So they wrote the old man a note saying, “Please send us an itemized bill.”

The man sent a bill that read:

Tapping with a hammer  …… ………. …….. $          2.00
Knowing where to tap      ……….. ……. …… $ 9, 998.00

Effort is important, but knowing where to make an effort makes all the difference!

What is Nanomedicine?


Nanomedicine is the medical application of nanotechnology. Nanomedicine ranges from the medical applications of nanomaterials, to nanoelectronic biosensors, and even possible future applications of molecular nanotechnology. Current problems for nanomedicine involve understanding the issues related to toxicity and environmental impact of nanoscale materials.

Nanomedicine seeks to deliver a valuable set of research tools and clinically useful devices in the near future. The National Nanotechnology Initiative expects new commercial applications in the pharmaceutical industry that may include advanced drug delivery systems, new therapies, and in vivo imaging. Neuro-electronic interfaces and other nanoelectronics-based sensors are another active goal of research. Further down the line, the speculative field of molecular nanotechnology believes that cell repair machines could revolutionize medicine and the medical field.


Beautiful Message

A Boy was born to a couple after eleven years of marriage. They were a loving couple and the boy was the gem of their eyes. When the boy was around two years old, one morning the husband saw a medicine bottle open.

He was late for office so he asked his wife to cap the bottle and keep it in the cupboard. His wife, preoccupied in the kitchen totally forgot the matter. 

The boy saw the bottle and playfully went to the bottle fascinated by its colour and drank it all. It happened to be a poisonous medicine meant for adults in small dosages. When the child collapsed the mother hurried him to the hospital, where he died. The mother was stunned. She was terrified how to face her husband. 

When the distraught father came to the hospital and saw the dead child he looked at his wife and uttered just five words. 


1. What were the five words?
2. What is the implication of this story?

Scroll down…








The husband just said “I am with you Darling”

The husband’s totally unexpected reaction is a proactive behavior. The child is dead. He can never be brought back to life. There is no point
in finding fault with the mother. Besides, if only he had taken time to keep the bottle away, this would not have happened.

No one is to be blamed. She had also lost her only child. What she needed at that moment was consolation and sympathy from the husband.
That is what he gave her.

If everyone can look at life with this kind of perspective, there would be much fewer problems in the world. “A journey of a thousand miles
begins with a single step.” Take off all your envies, jealousies, unforgiven, selfishness, and fears. And you will find things are actually not as difficult as you think. 


Sometimes we spend time in asking who is responsible or whom to blame, whether in a relationship, in a job or with the people we know. By this way we miss out some warmth in human relationship. 

Google Body Browser

Google has recently demoed an interesting WebGL application called Body Browser, which lets you explore the human body just like you can explore the world in Google Earth. Now you can try Google Body Browser before it’s added to Google Labs, assuming that you have a WebGL-enabled browser:

* WebGL is available, but not enabled by default in Chrome 8 (the latest stable version). Type about:flags in the address bar, click “Enable” next to “WebGL” and then click on “Restart now”. Please note that this is an experimental feature in Chrome 8.
* WebGL is enabled by default in Chrome 9 Beta, Chrome 9 Dev Channel, Chrome Canary Build and Firefox 4 beta.

Damon Hernandez was surprised to notice that the application doesn’t require a plugin. “Unlike other web based medical applications I have seen, no Flash, Java, or other plugins are needed. This application will run on any WebGL supported browser. Last year I got the opportunity to work on an open standards based web3D medical app for learning the bones of the body. After witnessing how that app really helped students learn the bones, I am sold on using web3D for medical education.”

Google’s demo:


ECG Attachment for Your iPhone


Seattle, Washington based Alivecor will be showing off its new iPhonECG system at the upcoming Consumer Electronics Show in Las Vegas.
The company has partnered with Oregon Scientific to manufacture the units, which are expected to sell for under $100 a piece.