ali raza

C#, .Net ,Asp.net and my thoughts

Monthly Archives: November 2007

Quotes from Dale Carnegie

  • Act enthusiastic and you will be enthusiastic.
    Dale Carnegie
  • Any fool can criticize, condemn, and complain – and most fools do.
    Dale Carnegie
  • Any fool can criticize, condemn, and complain but it takes character and self control to be understanding and forgiving.
    Dale Carnegie
  • Applause is a receipt, not a bill.
    Dale Carnegie
  • Are you bored with life? Then throw yourself into some work you believe in with all your heart, live for it, die for it, and you will find happiness that you had thought could never be yours.
    Dale Carnegie
  • Develop success from failures. Discouragement and failure are two of the surest stepping stones to success.
    Dale Carnegie
  • Do the hard jobs first. The easy jobs will take care of themselves.
    Dale Carnegie
  • Do the thing you fear to do and keep on doing it… that is the quickest and surest way ever yet discovered to conquer fear.
    Dale Carnegie
  • Don’t be afraid to give your best to what seemingly are small jobs. Every time you conquer one it makes you that much stronger. If you do the little jobs well, the big ones will tend to take care of themselves.
    Dale Carnegie
  • Each nation feels superior to other nations. That breeds patriotism – and wars.
    Dale Carnegie
  • Fear doesn’t exist anywhere except in the mind.
    Dale Carnegie
  • Fear not those who argue but those who dodge.
    Dale Carnegie
  • Feeling sorry for yourself, and your present condition, is not only a waste of energy but the worst habit you could possibly have.
    Dale Carnegie
  • First ask yourself: What is the worst that can happen? Then prepare to accept it. Then proceed to improve on the worst.
    Dale Carnegie
  • Flaming enthusiasm, backed up by horse sense and persistence, is the quality that most frequently makes for success.
    Dale Carnegie
  • Happiness doesn’t depend on any external conditions, it is governed by our mental attitude.
    Dale Carnegie
  • If only the people who worry about their liabilities would think about the riches they do possess, they would stop worrying.
    Dale Carnegie
  • If you believe in what you are doing, then let nothing hold you up in your work. Much of the best work of the world has been done against seeming impossibilities. The thing is to get the work done.
    Dale Carnegie
  • If you can’t sleep, then get up and do something instead of lying there worrying. It’s the worry that gets you, not the lack of sleep.
    Dale Carnegie
  • If you want to be enthusiastic, act enthusiastic.
    Dale Carnegie
  • If you want to conquer fear, don’t sit home and think about it. Go out and get busy.
    Dale Carnegie
  • If you want to gather honey, don’t kick over the beehive.
    Dale Carnegie
  • Inaction breeds doubt and fear. Action breeds confidence and courage. If you want to conquer fear, do not sit home and think about it. Go out and get busy.
    Dale Carnegie
  • Instead of worrying about what people say of you, why not spend time trying to accomplish something they will admire.
    Dale Carnegie
  • It isn’t what you have, or who you are, or where you are, or what you are doing that makes you happy or unhappy. It is what you think about.
    Dale Carnegie
  • Keep on raging – to stop the aging.
    Dale Carnegie
  • Men of age object too much, consult too long, adventure too little, repent too soon, and seldom drive business home to the full period, but content themselves with a mediocrity of success.
    Dale Carnegie
  • Most of the important things in the world have been accomplished by people who have kept on trying when there seemed to be no hope at all.
    Dale Carnegie
  • Most of us have far more courage than we ever dreamed possible.
    Dale Carnegie
  • Most of us have far more courage than we ever dreamed we possessed.
    Dale Carnegie
  • One of the most tragic things I know about human nature is that all of us tend to put off living. We are all dreaming of some magical rose garden over the horizon instead of enjoying the roses that are blooming outside our windows today.
    Dale Carnegie
  • Only the prepared speaker deserves to be confident.
    Dale Carnegie
  • Our fatigue is often caused not by work, but by worry, frustration and resentment.
    Dale Carnegie
  • People rarely succeed unless they have fun in what they are doing.
    Dale Carnegie
  • Remember happiness doesn’t depend upon who you are or what you have; it depends solely on what you think.
    Dale Carnegie
  • Speakers who talk about what life has taught them never fail to keep the attention of their listeners.
    Dale Carnegie
  • Success is getting what you want. Happiness is wanting what you get.
    Dale Carnegie
  • Take a chance! All life is a chance. The man who goes farthest is generally the one who is willing to do and dare.
    Dale Carnegie
  • Tell the audience what you’re going to say, say it; then tell them what you’ve said.
    Dale Carnegie
  • The essence of all art is to have pleasure in giving pleasure.
    Dale Carnegie
  • The expression a woman wears on her face is far more important than the clothes she wears on her back.
    Dale Carnegie
  • The ideas I stand for are not mine. I borrowed them from Socrates. I swiped them from Chesterfield. I stole them from Jesus. And I put them in a book. If you don’t like their rules, whose would you use?
    Dale Carnegie
  • The only way to get the best of an argument is to avoid it.
    Dale Carnegie
  • The person who goes farthest is generally the one who is willing to do and dare. The sure-thing boat never gets far from shore.
    Dale Carnegie
  • The person who seeks all their applause from outside has their happiness in another’s keeping .
    Dale Carnegie
  • The royal road to a man’s heart is to talk to him about the things he treasures most.
    Dale Carnegie
  • The successful man will profit from his mistakes and try again in a different way.
    Dale Carnegie
  • There are always three speeches, for every one you actually gave. The one you practiced, the one you gave, and the one you wish you gave.
    Dale Carnegie
  • There are four ways, and only four ways, in which we have contact with the world. We are evaluated and classified by these four contacts: what we do, how we look, what we say, and how we say it.
    Dale Carnegie
  • There is only one way… to get anybody to do anything. And that is by making the other person want to do it.
    Dale Carnegie
  • Those convinced against their will are of the same opinion still.
    Dale Carnegie
  • Today is life-the only life you are sure of. Make the most of today. Get interested in something. Shake yourself awake. Develop a hobby. Let the winds of enthusiasm sweep through you. Live today with gusto.
    Dale Carnegie
  • We all have possibilities we don’t know about. We can do things we don’t even dream we can do.
    Dale Carnegie
  • When dealing with people, remember you are not dealing with creatures of logic, but creatures of emotion.
    Dale Carnegie
  • When fate hands you a lemon, make lemonade.
    Dale Carnegie
  • You can close more business in two months by becoming interested in other people than you can in two years by trying to get people interested in you.
    Dale Carnegie
  • You can conquer almost any fear if you will only make up your mind to do so. For remember, fear doesn’t exist anywhere except in the mind.
    Dale Carnegie
  • You can make more friends in two months by becoming interested in other people than you can in two years by trying to get other people interested in you.
    Dale Carnegie
  • You never achieve success unless you like what you are doing.
    Dale Carnegie
  • Your purpose is to make your audience see what you saw, hear what you heard, feel what you felt. Relevant detail, couched in concrete, colorful language, is the best way to recreate the incident as it happened and to picture it for the audience.
    Dale Carnegie

Joe Satriani – Flying In A Blue Dream

don't Forget

don’t Forget

Forum with code

How to write word document in asp.net

You can add follwing code at page level function and called in button or page load

function Void GenerateWordDoc()

{

string strDocBody;

try

{

strDocBody = “<html “ + “xmlns:o=’urn:schemas-microsoft-com:office:office’ “ + “xmlns:w=’urn:schemas-microsoft-com:office:word'” + “xmlns=’http://www.w3.org/TR/REC-html40′>&#8221; + “<head>” + “<title>Dynamic Generated Document</title>”;

strDocBody = strDocBody + “<!–[if gte mso 9]>” + “<xml>” + “<w:WordDocument>” + “<w:View>Print</w:View>” + “<w:Zoom>100</w:Zoom>” + “<w:DoNotOptimizeForBrowser/>” + “</w:WordDocument>” + “</xml>” + “<![endif]–>”;

strDocBody = strDocBody + “<style> @page” + “{size:8.5in 11.0in; mso-first-footer:ff1; mso-footer: f1; mso-header: h1; border:solid navy 2.25pt; padding:24.0pt 24.0pt 24.0pt 24.0pt;” + ” margin:0.75in 0.50in 0.75in 0.50in ; “ + ” mso-header-margin:.5in; “ + ” mso-footer-margin:.5in; mso-paper-source:0;}” + ” div.Section1″ + ” {page:Section1;}” + “p.MsoFooter, li.MsoFooter, div.MsoFooter{margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; tab-stops:center 3.0in right 6.0in; font-size:12.0pt; font-family:’Arial’;}” + “p.MsoHeader, li.MsoHeader, div.MsoHeader {margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; tab-stops:center 3.0in right 6.0in; font-size:12.0pt; font-family:’Arial’;}” + “–>” + “</style>” + “</head>”;

strDocBody = strDocBody + “<body lang=EN-US style=’tab-interval:.5in’>”;

//Users Content in which he want to show in word doc , in my case i call a function GetData which return string from database

strDocBody += GetData();

strDocBody += “</div> </body> </html> “;

//Force this content to be downloaded as a Word document

Response.AddHeader(“Content-Type”, “application/msword”);

Response.AddHeader(“Content-disposition”, “attachment; filename=mydoc.doc”);

Response.Charset = “”; Response.Write(strDocBody);

}

catch (Exception ex)

{

Response.Write(ex.Message);

}

}

 

How to get Ip of Url in c#

Here is sample code  remember to add system.net namespace

IPHostEntry ip = Dns.GetHostByName (“www.yahoo.com”);
IPAddress [] IpA = ipE.AddressList;
for (int i = 0; i < IpA.Length; i++)
{
    Console.WriteLine (“IP Address {0}: {1} “, i, IpA[i].ToString ());
}

ibm 486 certification study Guide

For the Study or perpartion for Ibm 486 OOAD certificaiton i found these links

http://guide.zepho.com/version1/objective.html 

http://www.parlezuml.com/

http://www.uml-forum.com/

I used the free dll which writes pdf files as simple as we us system IO to simple files . I write the the page with inline scripting text and placed the following code . I fetch data from database to write to pdf file. i  remove html tags from data because data save in database is comes form htm text editor. You can download iTextSharp dll form here http://sourceforge.net/projects/itextsharp/

 

<%@ Page language=”c#” %>

<%@ Import Namespace=”System.IO” %>

<%@ Import Namespace=”iTextSharp.text” %>

<%@ Import Namespace=”iTextSharp.text.pdf” %>

<%@ Import Namespace=”System.Data” %>

<%@ Import Namespace=”iTextSharp.text.pdf” %>

<%

// step 1

// need to write to memory first due to IE wanting

// to know the length of the pdf beforehand

MemoryStream m = new MemoryStream();

Document document = new Document();

try {

// step 2: we set the ContentType and create an instance of the Writer

Response.ContentType = “application/pdf”;

PdfWriter.GetInstance(document, m);

string _Details = “”;

// step 3

document.Open();

if (Request.QueryString[“Id”] !=null)

{

// Fetching Data from database based on Query string

DataTable _Dt = myAppplication.Documents.DocumentsById(Convert.ToInt64(Request.QueryString[“Id”]));

// Removing Html tags using Regular expressions on required filed

_Details = Regex.Replace(_Dt.Rows[0][“Details”].ToString(), @”<(.|\n)*?>”, string.Empty);

}

}

// step 4

document.Add(new Paragraph(_Details));

} catch (DocumentException ex) {

Console.Error.WriteLine(ex.StackTrace);

Console.Error.WriteLine(ex.Message);

}

// step 5: Close document

document.Close();

// step 6: Write pdf bytes to outputstream

Response.OutputStream.Write(m.GetBuffer(), 0, m.GetBuffer().Length);

Response.OutputStream.Flush();

Response.OutputStream.Close();

%>

 

 

House of 1000 Mirrors

Long ago in a small, far away village, there was place known as the House of 1000 Mirrors. A small, happy little dog learned of this place and decided to visit. When he arrived, he bounced happily up the stairs to the doorway of the house. He looked through the doorway with his ears lifted high and his tail wagging as fast as it could. To his great surprise, he found himself staring at 1000 other happy little dogs with their tails wagging just as fast as his. He smiled a great smile, and was answered with 1000 great smiles just as warm and friendly. As he left the House, he thought to himself, “This is a wonderful place. I will come back and visit it often.”

In this same village, another little dog, who was not quite as happy as the first one, decided to visit the house. He slowly climbed the stairs and hung his head low as he looked into the door. When he saw the 1000 unfriendly looking dogs staring back at him, he growled at them and was horrified to see 1000 little dogs growling back at him. As he left, he thought to himself, “That is a horrible place, and I will never go back there again.”

All the faces in the world are mirrors. What kind of reflections do you see in the faces of the people you meet?

From archives; Shared on TextMail