Thursday, April 17, 2008

DEPLOYING PROJECTS IN VS.NET 2003

Deploying projects in Visual Studio.NET is fairly straightforward. Most of the process is automated for you through some convenient wizards so it doesn't require much effort. Keep in mind, though that you probably need the Windows Component Update Beta 1 on the machine you are deploying to. I suspect you also need the Microsoft .NET Framework, as well (for now). Also note that Microsoft states that the current Deployment may not work in the future:

"Caution Installers and merge modules created with the Beta release may not be 100 percent compatible with final Visual Studio.NET versions. While we want you to explore deployment and test the technology, we also want you to make sure that you don't distribute any installers or merge modules created with this release." - MSDN

Once your application is completed in Visual Studio, you can deploy it using the following steps:

First, choose Add New Project from the File Menu:



Once you've done this, choose Setup and Deployment Projects. Visual Studio then gives you a list of options for deploying your project, depending upon whether you are deploying to the web, in a compressed .cab file or as a windows setup program.



We will choose the setup wizard to deploy this particular application. The setup wizard brings up a nice step-by-step dialog for creating our setup project:



As stated in the dialog, the wizard creates an installer that you can use to install your project. The next screen asks you what kind of installer you wish to create:




We want a plain old Windows setup, so we choose setup for a rich client application. The next screen prompts us as to which files we would like installed:



If you just want to deploy the application with no source or documentation, then just choose Primary output. This will deploy the necessary exes and dlls for your application.

The next screen prompts you for additional files such as readme.txt, web pages, or anything else you'd like to include in the install that Microsoft didn't think of. In the case of Hangman, we added the sound files:



The last screen is just a report informing you of what you've done and where the vdp (visual deployment project) is created:




When you click finish, a directory is created for deployment. Now we need to build our project in order to deploy it, so simply choose build solution from the build menu. This will create the MySetupProject.msi file needed to install the application.

If we double click on MySetupProject.msi after it is created, it will launch the installation. For most installations, this just means xcopying all the necessary files into a directory under program files. In the case of the hangman project, these would be all the System.xxx.dll's, the Microsoft.xxx.dll's (CLR Libraries), nlp files (common language resources), the runtime class library mscorlib.DLL, mngdist.dll(not sure what it does, but I guess it manages distribution), xxx.wav (sound files) and of course our own executable(In this case Hangman.exe.

Tuesday, April 8, 2008

How to add AdRotator in ASP.NET using VB.NET

AdRotator is used to randomize pictures (images) whenever you load or refresh a web page. To add an AdRotator you simply have to drag a adrotator from toolbox and place it on your ASP.NET page. Then you have to add an xml file. The attributes of the xml file will be the following:

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>

<Ad>
<ImageUrl>Pix/yarn/1.gif</ImageUrl>
<AlternateText>Image is not displayed</AlternateText>
</Ad>

<Ad>
<ImageUrl>Pix/yarn/2.jpg</ImageUrl>

<AlternateText>Image is not displayed</AlternateText>
</Ad>

<Ad>
<ImageUrl>Pix/yarn/3.jpg</ImageUrl>
<AlternateText>Image is not displayed</AlternateText>
</Ad>
</Advertisements>


Now save the file with as "Ads.xml" and go back to your ASP.NET Page where you have place that AdRotator and give "Ads.xml" as a value to its AdvertisementFile attribute.

Run the page and you will see the images.

Sunday, April 6, 2008

HOW TO EMBED(ATTACH) CRYSTAL REPORT IN ASP.NET USING VB.NET

In this article I am going to describe you that how can you embed(attach) a crystal report in ASP.NET using VB.NET as a language. To embed a crystal report first you have to select a crystalreportviewer from Toolbox in ASP.NET environment and then you have to right click on the ASP.NET page and click on View Code option. When the view code page will open you will insert the following code.

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub btnReportGenerate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReportGenerate.Click
Try
Dim path As String
path = Server.MapPath(Request.ApplicationPath)
Dim report As New ReportDocument
report.Load(path + "\zreport.rpt")
report.SetDatabaseLogon("sa", "52xMAX")
CrystalReportViewer1.ReportSource = report
Response.Write("report launch successfully")
Catch ex As Exception
Response.Write("Error: " & Err.Description)
End Try
End Sub

End Class

Further if you want to add a parameter to the crystal report so that only the desired data will be print then you have to use this code. But Before that you have to insert text boxes on your ASP.NET so that you will pass the selective data to the crystal report. I am writing here the VB.NET Code, you have to insert text box by your self.

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Partial Class _Default
Inherits System.Web.UI.Page


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
crystalreportshow.Visible = False
ElseIf IsNothing(txtID.Text) Then
crystalreportshow.Visible = False
ElseIf Not IsNumeric(txtID.Text) Then
crystalreportshow.Visible = False
End If
End Sub

Protected Sub btnReportGenerate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReportGenerate.Click
Try
If IsNothing(txtID.Text) Then
Response.Write("Id must be filled")
ElseIf Not IsNumeric(txtID.Text) Then
Response.Write("ID must be in numeric")
Else
crystalreportshow.Visible = True
phase1.Visible = False
Dim path As String
path = Server.MapPath(Request.ApplicationPath)
Dim report As New ReportDocument
report.Load(path + "\zreport.rpt")
report.SetDatabaseLogon("sa", "52xMAX")

Dim crParameterFieldDefinitions As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions = report.DataDefinition.ParameterFields
Dim crParameter1 As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition = crParameterFieldDefinitions.Item("id")

Dim crparameter1value As CrystalDecisions.Shared.ParameterValues = crParameter1.CurrentValues

Dim disval As New CrystalDecisions.Shared.ParameterDiscreteValue

disval.Value = txtID.Text

crparameter1value.Add(disval)

crParameter1.ApplyCurrentValues(crparameter1value)

CrystalReportViewer1.ReportSource = report
Response.Write("report launch successfully")

End If
Catch ex As Exception
Response.Write("Error: " & Err.Description)
End Try
End Sub
End Class


In this way you can insert as many parameter as you can. Remember that parameter will select there data type as you pass the data to the report.

I hope that this will help you.

Monday, March 31, 2008

How to open URL of web.sitemap in a new window

Dear friends,

You can open a link of your web.sitemap available in VS 2005 in a new window by writing the following code:

<siteMapNode url="javascript: var w=window.open('http:\\www.google.com.pk');" title="GOOGLE" description="" />

I hope that will help you.

Tuesday, March 18, 2008

Network Printers is not accessed

Problem:
Some time network printers are not accessed from your computer. While they are accessed from other network clients.

Cause:
Your computer is actually not accessing the network computer through which the printer is attached.

Solution:
Access that remote computer first by following these steps:
1) Click on My Network Places Icon displayed on your desktop.
2) Double click on Entire Network Icon
3) Double click on Microsoft Windows Network Icon
4) Double Click on your network icon
5) Double click on that network computer withwhom printer is attached
6) Enter Username and password and press ok button

You can now access the printer which you were desired to access a few seconds ago.

USB Drive Icon not Show in My Computer

Some times our USB drive is loaded but its icon is not displayed? What to do in this case?

Cause:
This problem occurs when your drive letters are conflicting. Windows does not show the message either it load the USB drive and the drive with the same letter also work fine.
Solution:
Go to CONTROL PANEL -> Administrative Tools -> Computer Management -> Storage -> Disk Management.
Inside it you can see your USB drive. Right click on it and choose "change drive letter and path" from the popup menu. In this you will see an edit button. Click on edit button. Change the drive letter and click ok button and exit from the menu.

You will see the drive in your My Computer and also in Windows Explorer now.

Friday, March 14, 2008

HOW TO BUILD A LAN

Overview Building your own Ethernet LAN (local area network) is not nearly as difficult as it may seem. Using features from your OS and some special hardware (including cables, NICs, a hub/router, and an Internet connection), you can easily, and quickly, build a nifty home network complete with Internet access and file-sharing capabilities. The necessary hardware is easily obtained, and reasonably priced, making an Ethernet LAN possible for anyone with multiple computers, and the need to network them.

General Information A clear understanding of a LAN, as well as its limitations, is very helpful when considering the structure of your Ethernet LAN. You’ll need to decide on the physical structure that is best-suited for your networking needs. Visit SearchNetworking.com to read their definition of a LAN and information about LAN network technologies, hardware, and implementation strategies. General LAN information described in non-technical terms is available at the Web site http://en.wikipedia.org/wiki/LAN . A brief essay about building a LAN can be found on the Web page www.johnscloset.net/lan/. This essay describes the hardware and configuration of an Ethernet LAN that allows the computers on the network to share an Internet connection. This essay is just one part of a networking primer that contains discussions about LANs, WANs, and hardware.

LAN Resources Possibly the best sources for information about networking, Ethernet, and LANs is one of the many LAN tutorials found on the Web. LAN tutorial sites are listed below.

* http://www.lantronix.com/learning/
* developer.intel.com/design/network/
* www.howstuffworks.com/home-network.htm
* http://compnetworking.about.com/

LAN Hardware and Software The number of households with more than one PC is growing each year. The need for communication between these PCs and shared devices, such as printers and hard drives, has spawned a large market for network hardware. Consumers are faced with a variety of choices, from running Cat-5 cables between PCs, to wireless access.

The basic building blocks of simple and inexpensive LAN are a hub/router, Cat-5 cabling, and NIC for each computer on the network. You can check the price and availability of these items at Web sites such as www.pricewatch.com/ and outpost.com/. Both of these sites allow you to compare different products and purchase the products that you choose. The Web site www.starmicrotech.com/ specializes in selling network products. It’s a great source for LAN hardware.

Additional Links For an interesting perspective on LAN gaming, visit www.gideontech.com/. This site provides information about LAN parties--communities of gamers within a LAN who play interactive games, complete with instant messaging. Are you looking for a good book about building a high-speed LAN? Visit the page http://compnetworking.about.com/ for several recommended books about building LANs.

Docker Tutorial

 I have listed all the necessary commands of Docker below. In case if any is missing or if any improvement required, please share in comment...