Pages

Friday, January 29, 2010

Windows 8 is Coming Soon...

After the success of Windows 7 Microsoft is releasing its next version of operating system that is Windows 8 in July 2011. The key person from microsoft release the road map of the coming Microsoft product. Check this out...

"Windows 8" on July 1, 2011.

"Windows Server 2012" on July 2, 2012.

"Office 2012" on July 2, 2012.

"SQL Server 2011" on July 1, 2011.

"SharePoint Server 2013" on July 1, 2013.

"Exchange 2013" on July 1, 2013.

"OCS 2010" on Dec. 1, 2010.


Check this RoadMap


Enjoy!!!!

Monday, January 4, 2010

Ajax Slide Show extender Control

Hi All,
There are times when we have to include some images in our application, like in a slide shoe manner. So far displaying a slide show in our .aspx page we can use many controls just like we can use GRIDVIEW, DATA LIST or the best option is the Ajax Slide Show Extender Control. This is so simple and easy to use and we can easily disply so many images in our pages with the auto play facility and the previous and next buttons. here is the sample code to demonstrate the Ajax Slide Show Extender control..

In this code we just need to create a getSlide() method using that we can give the image path or can supply the images. The images can be stored in the application folder or in a seprate Image folder. This getSlide() is an WEB METHOD which we can create in the aspx itself..

here is the Code of the Body part of the aspx page...



body style="text-align: center">
<form id="form1" runat="server">

<h2 style="text-align: center">Slide Showh2>

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div style="text-align: center">


<script runat="Server" type="text/C#">
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
AjaxControlToolkit.
Slide[] slides = new AjaxControlToolkit.Slide[8];

slides
[0] = new AjaxControlToolkit.Slide("images/VaioX_Wallpaper.jpg", "Vaio", "Sony");
slides
[1] = new AjaxControlToolkit.Slide("images/av1.jpg", "Avtaar", "The Movie");
slides
[2] = new AjaxControlToolkit.Slide("images/Avatar Wallpapers james cameron 08.jpg", "Avtaar", "The Planes");
slides
[3] = new AjaxControlToolkit.Slide("images/chaman.jpg", "Bhains", "The Poem");
slides
[4] = new AjaxControlToolkit.Slide("images/Default_Avtaar.jpg", "Avtaar", "The Real Man");
slides
[5] = new AjaxControlToolkit.Slide("images/Dream Car.jpg", "Car", "The Dream Car");
slides
[6] = new AjaxControlToolkit.Slide("images/Dream Car1.jpg", "Car", "The Dream Car Again");
slides
[7] = new AjaxControlToolkit.Slide("images/our-story.jpg", "We the people", "The Story");
return
(slides);
}
script>

&nbsp; &nbsp;<br />
<br />

<asp:Image ID="Image1" runat="server" Height="316px" Width="388px" /><br />
<br />

<asp:Label ID="lblImageDescription" runat="server" /><br />
<br />


<asp:Button ID="Btn_Previous" runat="server" Text="Previous" />
<asp:Button ID="Btn_Next" runat="server" Text="Next" Width="64px" /><br />
<br />
<asp:Button ID="Btn_Play" runat="server" Text="Play" /><br />


<cc1:SlideShowExtender ID="SlideShowExtender1"
AutoPlay
="true" ImageDescriptionLabelID="lblImageDescription"
Loop="true" NextButtonID="Btn_Next" PlayButtonID="Btn_Play"
PlayButtonText
="Play" PreviousButtonID="Btn_Previous"
SlideShowServiceMethod
="GetSlides" StopButtonText="Stop"
TargetControlID
="Image1" runat="server">
cc1:SlideShowExtender>
div>
form>
body>



This is all we need to put in the aspx page and the slide show is ready, hope this will help you out. In case of any problem you can post your problem as comment... Waiting for your comments...........


Thanks
Anil Kumar Pandey
System Architect, MVP
Mumbai, Maharshtra

Wednesday, December 9, 2009

Escape Sequences


While Coding we use many special characters, and we have seen some characters which start with a backslash ("\"). All the characters which starts from backslash ("\") is known as the escape sequence. There are several escape sequence are used in the c# here are the list of that. you can use them according to the use..

\a Bell (alert)
\b Backspace
\f Formfeed
\n New line
\r Carriage return
\t Horizontal tab
\v Vertical tab
\' Single quotation mark
\" Double quotation mark
\\ Backslash
\? Literal question mark
\ooo ASCII character in octal notation
\xhh ASCII character in hexadecimal notation
\xhhhh Unicode character in hexadecimal notation if this escape sequence is used in a wide-character constant or a Unicode string literal.


Hope the information was useful.. Happy coding!!!!


Thanks
Anil Kumar Pandey
System Architect, MVP
Mumbai, Maharshtra

Tuesday, December 8, 2009

Executing a batch file with parameter from C#

hello All,
Some time we need to run or execute a batch file inside our code behind using the c# code, for that reason here I am going to show that how can we run a batch file inside the code behind. We can also pass the required parameter to run the file. Please check the following code.


try
{
System.Diagnostics.Process() objProcess = new System.Diagnostics.Process(); // Create the process object
objProcess.
StartInfo.FileName = "c:\\Anil\\testAnil; //batch File Name
objProcess.StartInfo.Arguments = "
c:\\Anil\\testAnil" + strXmlFileName;//paramter file name
objProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
objProcess.Start();
//Wait until the process passes back an exit code
objProcess.WaitForExit();
//Free resources associated with this process
objProcess.Close();
}
catch (Exception ex)
{
MessageBox.Show("
Could not start process " + FileNameNew, "Error");
}


I hope this will solve your problem. Waiting for your comments..!! Happy Coding!!


Thanks
Anil Kumar Pandey
System Architect, MVP
Mumbai, Maharshtra

Thursday, December 3, 2009

Reading a PDF file content using iTextSharp

hi there,
iTextSharp has made reading the DLL so easy, that using a simple function we can read the content of the PDF file. We just need to use this dll, this can be easily downloaded from the following sites.


Using the following fuction we can read the PDF file by specifying the page no.. here is the code.



using iTextSharp.text.pdf;


string filename = "FileName";
PdfReader reader
= new PdfReader(filename);
int intPageCount = reader.NumberOfPages;
string strContent = ParsePdfText(filename, 1, intPageCount);



public string ParsePdfText(string sourcePDF, int fromPageNum,int toPageNum)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
try
{
PdfReader reader
= new PdfReader(sourcePDF);
byte[] pageBytes = null;
PRTokeniser token
= null;
int tknType = -1;
string tknValue = string.Empty;
for (int i = fromPageNum; i <= toPageNum; i += 1)
{
pageBytes
= reader.GetPageContent(i);
if ((pageBytes != null))
{
token
= new PRTokeniser(pageBytes);
while (token.NextToken())
{
tknType
= token.TokenType;
tknValue
= token.StringValue;
if (tknType == PRTokeniser.TK_STRING)
{
sb
.Append(token.StringValue);
}

else if (tknType == 1 && tknValue == "-600")
{
sb
.Append(" ");
}
else if (tknType == 10 && tknValue == "TJ")
{
sb
.Append(" ");
}
}
}
}
}
catch (Exception ex)
{
MessageBox
.Show("Exception occured. " + ex.Message);
return string.Empty;
}
return sb.ToString();
}

The varibale strContent will contain all the data present in the PDF file. using the starting page no and End page no we can spicy the limit from which page to which we want to read the content.

Isn't that so easy.. waiting for all your comment..

Thanks
Anil Kumar Pandey
System Architect, MVP
Mumbai, Maharshtra

Kontera