Google Search

Google
 

Wednesday, January 30, 2008

Dispose Vs Finalize

Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles ,database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize Method on an object (destructor syntax in C# and the Managed Extensions for C++). The garbage collector calls this method at some point after there are no longer any valid references to the object.


In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose method provided by the IDisposable Interface. The consumer of the object

Friday, January 18, 2008



In 1582, the Catholic Church decided to fine-tune the calendar they used since they felt Easter didn’t fall anymore on what they thought was the correct day every year. And thus the Gregorian Calendar was invented to replace the Julian Calendar. When that was done, they had to get rid of 10 days to re-adjust the yearly cycle. So for the Church, the last day of the Julian calendar was Thursday October 4 1582, which was followed the next morning by the first day of the Gregorian calendar, Friday October 15 1582.
But not everyone was Catholic, or followed these Catholic decisions in the matter of calendaring. Catholic countries switched from the Julian to the Gregorian system relatively quickly (Spain, Italy, Poland, etc), but others followed much later (Russia, 1917; Greece, 1923). The United Kingdom and its colonies (like Canada and the American Colonies) did the switchover in 1752 and got rid of 10 days when switching calendar: Wednesday September 2 1752 was followed by Thursday September 14 1752 for these people.
This can be seen in Ubuntu. I’m running on this laptop in Canada using the en_CA.UTF-8 locale. And when I run the “cal” command from the command-line, I get:

So we see correctly (at least for me in English Canada) that the missing 10 days in 1752, but not in 1582. I haven’t checked but I’m assuming (and hoping) that in other locales the missing 10 days would appear in the correct year for that particular location. You can get a long list of these actual Julian to Gregorian switchover dates for various countries and regions at this web site.
We also have a bug report currently open (and confirmed) in Launchpad about not removing 10 days in 1582 (Bug
#20276). When I first commented in that bug report last year, I was under the assumption that indeed we needed to remove 10 days in the output of the cal command for 1582, and it seems the output was still wrong for the year 1752 back then (obviously that has been solved since). Now, after reading a bit more this morning about all this, I’m starting to think that maybe this bug should be rejected since that missing 10 days has to appear on a country-by-country basis, and not in 1582 for everyone.


Thursday, January 10, 2008

When 1 rupee = 45 dollars

Scene 1

Venue : Microsoft Corporation, New York , US Some s/w engineers are seeing some photographs.
s/w engg 1 : What's that?

s/w engg 2 : Bob's photographs from India .

s/w engg 1 : Wow. Let me see. Which is this place?

s/w engg 3 : (Sees the photo) This is tidel park,chennai

s/w engg 1 : Fundoo yaar! And what is this? He got Bajaj Pulsar also.

s/w engg 2 : Let me see (sees). This guy enjoys life maan…

s/w engg 3 : You know how much an Bajaj Pulsar costs?

Nearly 60K…..

Say it in dollars… (60000*45 = 27,00,000 dollars)

s/w engg 2: Oops. We can't dream of such a thing here.

s/w engg 1 : Let's go to India & try for a job.

[Everybody excited.]



———— ——— ——— ——— ——— ——-

SCENE 2

Venue: Sun Microsystems, SanFrancisco , California , US

s/w engg 1: I'm with you man. My Visa is expected anytime. Soon I will

fly to India

s/w engg 2: Ohhh…. When is the party?

s/w engg 1: When I get it on hand.

s/w engg 2: Where will you be working?

s/w engg 1 : I'll be working in ambatur

s/w engg 2 : Oh! ambatur. Great yaar. where it is…

s/w engg 1 : It is in chennai.

s/w engg 3 : Fundoo place yaar. Nice climate Not like California .

You'll love the weather yaar. One of my friends is in coimbatore …

He says it's the ultimate place to live in. Cool maan.

s/w engg 2 : Who is the client yaar?

s/w engg 1: You know Municipal Corporation of chennai ?

s/w engg 3 : One of my friends is there in

the Road Cleaning Division. Most challenging job yaar. People are

working in the cutting edge of technology there.

s/w engg 1 : I'll be writing software for the accounts department of

the GCU.

s/w engg 2: GCU? what it means…?

s/w engg 1 : that is Garbage Collecting Unit.

s/w engg 3 : : Great yaar. That's what I like about

that country. You can get a job which requires all your skill. Not like

here. See I'm writing software for the space shuttle remote control.

I hate this.

s/w engg 1 : Don't worry guys. I'll give you my

Hotmail id. You can send your resume to me and I'll forward it to the

HRD.

[Everybody takes down his Hotmail id.]

———— ——— ——— ——— ——— ——-

SCENE 3

Venue: Intel Corp. US

s/w engg 1: Great news guys. Our George has got

admission in the IGNOU with scholarship for B.A History. A

great new field yaar…

All are excited…

George : Got my Visa yesterday. It's all finalized now.

s/w engg 2 : Congrats yaar. So you are out of this country.

s/w eng g 1 : B.A in Histroy…ohh. ..man, enjoy your life there!!

s/w engg 2 :Got full aid, eh?

George : Yeah. Got the UGC scholarship That will be 1200 Rupees / year.

s/w engg 1 : Great. Enjoy.

s/w engg 2 : (Thinking loud): 1200 Indian Rupees…!

that means 1200 * 45 = 54000 Dollars… with that amount I can buy an

three bed-room flat & a Mercedes here…!!!

———— ——— ——— ——— ——— ——— -

SCENE 4

A foreigner working in Hyderabad as Software Engg gets

a call from his Home ..

Father : What are you doing son ?

S/w Eng : Having breakfast ?

Father : what are you eating ?

S/w Eng: Coconut Sauce and Rice Bread i.e.,(Idli and

Chutney)

Education makes people easy to lead but difficule to drive, Easy to govern but impossible to enslave.

Wednesday, January 9, 2008

This is your first time!!!-Fun Story

Once upon a time a married couple celebrated their 25th marriage anniversary. They had become famous in the city for not having a single conflict in their period of 25 years. Local newspaper editors had gathered at the occasion to find out the secret of their well known “happy going marriage”.

Editor: “Sir. It’s amazingly unbelievable. How did you make this possible?”

Husband recalling his old honeymoon days said: “We had been to Shimla for honeymoon after marriage. Having selected the horse riding finally, we both started the ride on different horses. My horse was pretty okay but the horse on which my wife was riding seemed to be a crazy one.
On the way ahead, that horse jumped suddenly, making my wife topple over. Recovering her position from the ground, she patted the horse’s back and said ”This is your first time”. She again climbed the horse and continued with the ride. After a while, it happened again. This time she again kept calm and said “This is your second time” and continued. When the horse dropped her third time, she silently took out the revolver from the purse and shot the horse dead !!
I shouted at my wife: “What did you do you psycho. You killed the poor animal. Are you crazy?” ..
She gave a silent look and said: “This is your first time!!!”.”

Husband:”That’s it. We are happily married ever after. “

Thursday, January 3, 2008

Fusion

Add to Google Reader or Homepage

EFFECTS OF COLD WATER

For those who like to drink cold water, this article is applicable to you.
It is nice to have a cup of cold drink after a meal. However, the cold
water will solidify the oily stuff that you have just consumed. It will slow
down the digestion. Once this "sludge" reacts with the acid, it will break down
and be absorbed by the intestine faster than the solid food. It will line
the intestine. Very soon, this will turn into fats and lead to cancer. It
is best to drink hot soup or warm water after a meal.
A serious note about heart attacks - You should know that not every heart
attack symptom is going to be the left arm hurting. Be aware of intense
pain in the jaw line.

You may never have the first chest pain during the course of a heart
attack.

Nausea and intense sweating are also common symptoms. 60% of people who
have a heart attack while they are asleep do not wake up. Pain in the jaw can
wake you from a sound sleep. Let's be careful and be aware. The more we
know the better chance we could survive.
A cardiologist says if everyone who reads this message sends it to 10
people, you can be sure that we'll save at least one life. Read this &
Send the link to a friend. It could save a life. So, please be a true friend
and send this article to all your friends you care about.
Its never late....Forward soon...

Wednesday, January 2, 2008

Memorial at Harvard University

A lady in a faded grey dress and her husband, dressed in a homespun suit walked in timidly without an appointment into the Harvard University President's outer office.

The secretary could tell in a moment that such backwoods, country hicks had no business at Harvard and probably didn't even deserve to be in Harvard.

"We want to see the President," the man said softly.

"He'll be busy all day," the secretary snapped.

"We'll wait," the lady replied.

For hours the secretary ignored them, hoping that the couple would finally become discouraged and go away. They didn't and the secretary grew frustrated and finally decided to disturb the president." Maybe if you see them for a few minutes, they'll leave," she said to him. The President, stern faced and with dignity, strutted toward the couple.

The lady told him, "We had a son who attended Harvard for one year. He loved Harvard. He was happy here. But about a year ago, he was accidentally killed. My husband and I would like to erect a memorial to him, somewhere on campus."

The president wasn't touched.... He was shocked. "Madam," he said, gruffly, "we can't put up a statue for every person who attended Harvard and died. If we did, this place would look like a cemetery."

"Oh, no," the lady explained quickly. "We don't want to erect a statue. We thought we would like to give a building to Harvard."

The president rolled his eyes. He glanced at the gingham dress and homespun suit, and then exclaimed, "A building! Do you have any earthly idea how much a building costs? We have over seven and a half million dollars in the physical buildings her! e at Harvard."

For a moment the lady was silent. The president was pleased. Maybe he could get rid of them now.

The lady turned to her husband and said quietly, "Is that all it costs to start a university? Why don't we just start our own?"

Her husband nodded. The president's face wilted in confusion and bewilderment.

Mr. and Mrs. Leland Stanford got up and walked away, traveling to Palo Alto, California where they established the University that bears their name, 'Stanford University', a memorial to a son that Harvard no longer cared about.

Binding Reports to windows Treeview control

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using windowsSSRS.SSRS;

namespace windowsSSRS
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
CatalogItem[] lst;
// Report Server defines the URL to root of the
// Reporting Services home page.
public static string ReportServer
{
get { return "http://reporting/reportserver"; }
}

// ReportPath, when appended to the ReportServer property,
// will define the root of the report search.
// For example, to view all available reports on the report
// server, use "/" as the ReportPath. Setting the value to
// "/MyDemoReports", would only show reports and subdirectories
// under http://ReportServer/MyDemoReports.
public static string ReportPath
{
get { return "/SampleReports"; }
}

// There are a couple places where we need to do string
// manipulation to add and remove path seperators -
// sometimes the seperator needs to be passed as an array
// of char, othertimes as a string. These two properties
// simply define both so the code is a little cleaner
// when we do the string munging.
public static char[] PathSeparatorArray
{
get { return pathSeparatorArray; }
}

public static string PathSeparatorString
{
get { return pathSeparatorString; }
}

protected static char pathSeparator = '/';
protected static char[] pathSeparatorArray = { pathSeparator };
protected static string pathSeparatorString = new string(pathSeparator, 1);
private void Form1_Load(object sender, EventArgs e)
{

ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
//CatalogItem[] lst;
lst = rs.ListChildren("/", true);

Array name;
for (int i = 0; i < lst.Length; i++)
{
if (lst[i].Type == ItemTypeEnum.Report)
{
listBox1.Items.Add(lst[i].Path.ToString());
}
name=lst[i].Path.Split('/');
}

BuildTree(lst);
//treeView1.Nodes.Insert(0, "/");
treeView1.ExpandAll();
}

private void BuildTree(CatalogItem[] catalogItems)
{

for (int i = 0; i < lst.Length; i++)
{
if (lst[i].Type == ItemTypeEnum.Report)
{
string path = lst[i].Path.Remove(0, 1);
string[] tokens = path.Split('/');
BuildNodesFromTokens(tokens, 0, treeView1.Nodes);
}
}


}

private void BuildNodesFromTokens(string[] tokens, int index,
TreeNodeCollection nodes)
{
TreeNode node = null;

// first, see if a node for the current token
// exists on this level
for (int i = 0; i < nodes.Count; i++)
{
if (nodes[i].Text == tokens[index])
{
// a node was found at this level, no need to continue searching
node = nodes[i];
break;
}
}

// no node was found, will need to create a new tree node
if (node == null)
{
node = new TreeNode();
node.Text = tokens[index];
nodes.Add(node);

// check if this is the final token, which means this token represents a report name
if (tokens.Length - 1 == index)
{

}
}

// if we have not reached the end of the token list,
// increase the level by (move down the tree) and
// call ourselves again
index++;
if (tokens.Length > index)
{
BuildNodesFromTokens(tokens, index, node.Nodes);
}

}



private void treeView1_AfterSelect(object sender, TreeNodeMouseClickEventArgs e)
{
String grp = string.Empty;
String rname = string.Empty;
if (e.Node.Parent != null)
{
grp = e.Node.Parent.Text.ToString();
rname = e.Node.Text;
string ull = "http://localhost/ReportServer/Pages/ReportViewer.aspx?%2f" + grp + "%2f" + rname + "&rs:Command=Render";
webBrowser2.Navigate(ull);
}
else
{
string ull = string.Empty;
webBrowser2.Navigate(ull);
}
}

}
}

Tuesday, January 1, 2008

Chating from command prompt

If you want personal chat with a friend
you don't need to download any yahoo messenger
All you need is your friends IP address and Command Prompt.
Firstly, open Notepad and enter:
@echo off
:A
Cls
echo MESSENGER
set /p n=User:
set /p m=Message:
net send %n% %m%
Pause
Goto A
Now save this as "Messenger.bat". Open the .bat file and in Command
Prompt you should see:
MESSENGER
User:
After "User" type the IP address of the computer you want to contact.
After this, you should see this:
Message:
Now type in the message you wish to send.Before you press "Enter" it should look like this:
MESSENGER
User:27.196.391.193
Message: Hi

Everything has a gender

You may not know this but many nonliving things have a gender.

A Web Page is Female, because it's always getting hit on.

A Subway is Male, because it uses the same old lines to pick people up.

Ziploc Bags are Male, because they hold everything in, but you can see right through them.

Copiers are Female, because once turned off; it takes a while to warm them up again.

It's an effective reproductive device if the right buttons are pushed, but can wreak havoc if the wrong buttons are pushed.

A Tire is Male , because it goes bald and it's often over-inflated.

An Hourglass is Female, because over time, the weight shifts to the bottom.

A Hot Air Balloon is Male, because, to get it to go anywhere, you have to light a fire under it, and of course, there's the hot air part.

Sponges are Female, because they're soft, squeezable and retain water.

A Hammer is Male , because it hasn't changed much over the last 5,000 years, but it's handy to have around.

A Remote Control is Female. Ha! You thought it'd be male ,didn't you?

But consider this - it gives a man pleasure, he'd be lost without it, and while he doesn't always know the right buttons to push, he keeps trying!