Skip to main content

Posts

Showing posts from January, 2011

code to send Mail From Web Application using c sharp

using System.Web.Mail; using System; public class MailSender { public static bool SendEmail( string pGmailEmail, string pGmailPassword, string pTo, string pSubject, string pBody, MailFormat pFormat, string pAttachmentPath ) { MailMessage myMail = new MailMessage(); myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver","smtp.gmail.com"); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/smtpserverport","465"); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/sendusing","2"); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1"); //Use 0 for anonymous myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/sendusername",pGmailEmail); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/sendpassword...

Encrypt Decrypt password using asp dot net

using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Security.Cryptography; namespace xyz { class abc { public static string Encrypt(string plainText, string passPhrase, string saltValue, string hashAlgorithm, int passwordIterations, string initVector, int keySize) { // Convert strings into byte arrays. // Let us assume that strings only contain ASCII codes. // If strings include Unicode characters, use Unicode, UTF7, or UTF8 // encoding. byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); // Convert our plaintext into a byte array. // Let us assume that plaintext contains UTF8-encoded characters. byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText); // First, we must create a password, from which the key will be derived. // This password will be generated from the specified passphrase and ...

Code help with example of crystal Reports

Export Crystal Report to Excel Sheet MemoryStream oStream; // using System.IO oStream = (MemoryStream) rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel); Response.Clear(); Response.Buffer = true; Response.ContentType = "appliaction/ms-excel"; Response.BinaryWrite(oStream.ToArray()); Response.End() Export Crystal Report to Excel ReportDocument rpt=new ReportDocument();//set a ReportPath and assign the dataset to reportdocument objectrpt.Load(Server.MapPath("Report1.rpt")); rpt.SetDataSource(ds); //assign the values to crystal report viewerCrystalReportViewer1.ReportSource = rpt; CrystalReportViewer1.DataBind(); //Exporting PDFMemoryStream oStream; // using System.IOoStream = (MemoryStream)rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); Response.Clear(); Response.Buffer = true;Response.ContentType = "application/pdf"; Response.BinaryWrite(oStream.To...

Ajax examples in asp.net

Customize Ajax Editor Control using System;using System.Data; using System.Configuration; using System.Linq;using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq;using AjaxControlToolkit.HTMLEditor; /// /// Summary description for customEditor /// /// namespace myControls { public class customEditor : Editor { public customEditor() { // // TODO: Add constructor logic here // } protected override void FillTopToolbar() { TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Bold()); TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Italic()); TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Copy()); TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Cut()); TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.T...

Why the colour of tyre is black?

Why the colour of tyre is black.? In the starting days of invention of tyres, black coloured tyres were rarely seen. The general rubber used in the manufacture of tyres was brown in colour. So the tyres were also in the brown colour. But the black colour which is presently used is the unexpected result in an experiment. In 1885, a tyres manufacturing company named M/s. B F Good Rich has tried with dark colour in the manufacture of tyres so that dust and dirt will not be visible clearly. They used black coloured carbon material in the mixture used to make tyres. They observed that the black coloured tyres thus manufactured not only had colour difference but also were 5 times more durable than the brown coloured ones and from then they started mfg black coloured tyres. Though the latest models of tyres have acquired the qualities of strength and different styles but the black colour is not changed. It is because of the presence of carbon black. It is used to improve the life of ti...

use of compilers and interpreters as Language translators

Language is for communication. In order to communicate with 2 person, we need a common language. If no such language exists, we need a translator to perform the communication. In case of computers, it can understand only electric pulses(Digital Signals). We will represent the signals using binary number system(1/0 for low/ high). But writing a program in binary is very difficult (technically, not feasible). So for ease of use we can use some words to group common operations and these mnemonic language is called as assembly language. Still, writing big programs are very difficult in assembly language. And the programs written in one machine may not work in other machines. So a situation arise to create a more generic, platform independent, easy to use, simple to debug language, and a program written in this language should be easy maintainable. A translator program for a computer accepts a program written in a language, which is not understandable by the computer and translate to th...

List of good C++ books

For the beginner ---------------- 1. C++ Primer - Stan Lippman, Joseé Lajoie 2. Thinking in C++ (vol 1 & 2) - Bruce Eckel For the intermediate programmer (perhaps new to C++) ------------------------------------------ 1. Accelerated C++ - Andrew König, Barbara Moo 2. The C++ Standard Library: Tutorial and Reference Guide - Nicolai M Josuttis 3. C++ Templates - Nicolai M Josuttis, David Vandevoorde For the practising C++ programmer ------------------------------------------ 1. The C++ Programming Language - Bjarne Stroustrup 2. Effective C++ 3/e - Scott Meyers 3. More Effective C++ - Scott Meyers 4. Effective STL - Scott Meyers 5. More C++ Gems - ed Robert Martin 6. The STL Tutorial and Reference Guide - Dave Musser, Atul Saini (the ANSI standard edition) 7. Exceptional C++ - Herb Sutter 8. The C++ Standard Library Extensions: A tutorial and reference - Pete Becker 9. More Exceptional C++ - Herb Sutter 10. C++ Common Knowledge - Steve Dewhurst 11. Beyond the C...

Memory layout in c program?

The distinction between stack and heap relates to programming. When you look at your computer memory, it is organized into three segments: •text (code) segment •stack segment •heap segment text (code) segment The text segment (often called code segment) is where the compiled code of the program itself resides. When you open some EXE file in Notepad, you can see that it includes a lot of "Gibberish" language, something that is not readable to human. It is the machine code, the computer representation of the program instructions -The two sections other from the code segment in the memory are used for data. stack segment The stack is the section of memory that is allocated for automatic variables within functions. Data is stored in stack using the Last In First Out (LIFO) method. This means that storage in the memory is allocated and deallocated at only one end of the memory called the top of the stack. Stack is a section of memory and its associated registers that ...

DBMS features and capabilities and DBMS building blocks

DBMS building blocks A DBMS includes four main parts: modeling language, data structure, database query language, and transaction mechanisms: 1)Modeling language A data modeling language to define the schema of each database hosted in the DBMS, according to the DBMS database model. The four most common types of models are the: * hierarchical model, * network model, * relational model, and * object model. 2)Data structure Data structures (fields, records, files and objects) optimized to deal with very large amounts of data stored on a permanent data storage device (which implies relatively slow access compared to volatile main memory) 3) Database query language A database query language and report writer allows users to interactively interrogate the database, analyze its data and update it according to the users privileges on data. It also controls the security of the database. Data security prevents unauthorized users from viewing or updating the database. Using pass...

List of all airports in India

This is a List of all airports in India please add in comments if any name is missing in this list. Agartala Singerbhil Airport (IXA) Agatti Island Agatti Island Airport (AGX) Agra Kheria Airport (AGR) Ahmedabad Airport (AMD) Aizawl Aizawl Airport (AJL) Akola Airport (AKD) Allahabad Bamrauli Airport (IXD) Along Airport (IXV) Amritsar Raja Sansi Airport (ATQ) Aurangabad Chikkalthana Airport (IXU) Bagdogra Airport (IXB) Balurghat Balurghat Airport (RGH) Bangalore Hindustan Airport (BLR) Bareli Bareli Airport (BEK) Belgaum Sambre Airport (IXG) Bellary Airport (BEP) Bhatinda Airport (BUP) Bhavnagar Airport (BHU) Bhopal Airport (BHO) Bhubaneswar Bhubaneswar Airport (BBI) Bhuj Rudra Mata Airport (BHJ) Bikaner Airport (BKB) Bilaspur Airport (PAB) Bombay (Mumbai) Chhatrapati Shivaji Airport (BOM) Calcutta (Kolkata) Netaji Subhas Chandra Airport (CCU) Car Nicobar Car Nicobar Airport (CBD) Chandigarh Airport (IXC) Coimbatore Peelamedu Airport (CJB) Cooch Behar Cooch Behar Airport (COH) Cuddapah...

Complete lists of universities in India

This is Complete lists of universities in India I hope your searching name is present in this list if not then you can leave new name as a comments. 1 Anna University Tiruchirappalli 2 B.R.Ambedkar Bihar university. 3 Bengal Engineering and Science University, Shibpur 4 Directorate of Technical Education, Chennai (DoTE Chennai) 5 Indira Gandhi National TribalUniversity, Amarkantak 6 Academy of Maritime Education and Training 7 Acharya N.G. Ranga Agricultural University 8 Acharya Nagarjuna University 9 Adikavi Nannaya University 10 Alagappa University 11 Aliah University 12 Aligarh Muslim University 13 All Entrance Exams 14 All India Institute of Medical Sciences 15 All India Management Association (AIMA) 16 Allahabad University 17 Amaravti University 18 Amity University 19 Amrita Vishwa Vidyapeetham 20 Anand Agricultural University 21 Andhra University 22 Anna University Chennai 23 Anna University Coimbatore 24 Anna University Tirunelvel...