Sunday, October 28, 2007

How many classes can a single .NET DLL contain?

It can contain many Classes./p>

True or False: To test a Web service you must create a windows application or Web application to consume this service?

False, the webservice comes with a test page and it provides HTTP-GET method to test.

Which control would you use if you needed to make sure the values in two different controls matched?

CompareValidator Control

Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?

DataTextField property

What does WSDL stand for?

(Web Services Description Language)

True or False: A Web service can only be written in .NET?


What is the transport protocol you use to call a Web service?

SOAP is the preferred protocol.

What tag do you use to add a hyperlink column to the DataGrid?


What tags do you need to add within the asp:datagrid tags to bind columns manually?

Set AutoGenerateColumns Property to false on the datagrid tag

Name two properties common in every validation control?

ControlToValidate property and Text property.

What base class do all Web Forms inherit from?

The Page class.

What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?

You must set the DataSource property and call the DataBind method.

How can you provide an alternating color scheme in a Repeater control?

Use the AlternatingItemTemplate

Which template must you provide, in order to display data in a Repeater control?


Can you edit data in the Repeater control?

No, it just reads the information from its data source

Which method do you invoke on the DataAdapter control to load your generated dataset with data?

The .Fill() method

Whats MSIL, and why should my developers need an appreciation of it if at all?

MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.

Explain what a diffgram is, and a good use for one?

The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.

Describe the difference between inline and code behind.

Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

Whats an assembly?

Assemblies are the building blocks of the .NET framework.

Overview of assemblies from MSDN

Can you explain what inheritance is and an example of when you might use it?

When you want to inherit (use the functionality of) another class. Base Class Employee. A Manager class could be derived from the Employee base class.

If I’m developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?

Maintain the login state security through a database.

Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?

This is where you can set the specific variables for the Application and Session objects.

Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

· A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.

· A DataSet is designed to work without any continuing connection to the original data source.

· Data in a DataSet is bulk-loaded, rather than being loaded on demand.

· There's no concept of cursor types in a DataSet.

· DataSets have no current record pointer You can use For Each loops to move through the data.

· You can store many edits in a DataSet, and write them to the original data source in a single operation.

Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.

What does the "EnableViewState" property do? Why would I want it on or off?

It enables the viewstate on the page. It allows the page to save the users input on a form.

Should validation (did the user enter a real date) occur server-side or client-side? Why?

Client-side. This reduces an additional request to the server to validate the users input.

What type of code (server or client) is found in a Code-Behind class?

Server-side code.

Explain the differences between Server-side and Client-side code?

Server-side code runs on the server. Client-side code runs in the clients’ browser.

What data type does the RangeValidator control support?

Integer,String and Date.

Suppose you want a certain ASP.NET function executed on MouseOver over a certain button. Where do you add an event handler?

It’s the Attributesproperty, the Add function inside that property. So btnSubmit.Attributes.


What’s a bubbled event?

When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

What’s the difference between Codebehind="MyCode.aspx.cs" and

CodeBehind is relevant to Visual Studio.NET only.

Where do you store the information about the user’s locale?


Where does the Web page belong in the .NET Framework class hierarchy?


What methods are fired during the page load?

Init() - when the page is instantiated, Load() - when the page is loaded into server memory, PreRender() - the brief moment before the page is displayed to the user as HTML, Unload() - when page finishes loading.

What’s the difference between Response.Write() and Response.Output.Write()?

Ans > The latter one allows you to write formatted output.

Technorati Tags: ,

Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.

inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.

Technorati Tags: , ,

Thursday, October 11, 2007

Adding Tooltip to a component in C#

Tooltip is a simply a nice ways to show a shot help to any component or control ...

Here is a short example for how to add a tooltip to a component ..

Source Code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class Form1 : Form
  private System.Windows.Forms.PictureBox pictureBox1;
  private System.Windows.Forms.ToolTip toolTip1;
  private System.Windows.Forms.ToolTip toolTip2;
  private System.Windows.Forms.PictureBox pictureBox2;
  public Form1() {
  private void InitializeComponent()
        this.pictureBox1 = new System.Windows.Forms.PictureBox();
        this.toolTip1 = new System.Windows.Forms.ToolTip(new System.ComponentModel.Container());
        this.toolTip2 = new System.Windows.Forms.ToolTip(new System.ComponentModel.Container());
        this.pictureBox2 = new System.Windows.Forms.PictureBox();
        // pictureBox1
        this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.pictureBox1.Location = new System.Drawing.Point(12, 24);
        this.pictureBox1.Name = "pictureBox1";
        this.pictureBox1.Size = new System.Drawing.Size(100, 50);
        this.pictureBox1.TabIndex = 0;
        this.pictureBox1.TabStop = false;
        this.toolTip1.SetToolTip(this.pictureBox1, "This is a tooltip.");
        // toolTip1
        this.toolTip1.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info;
        this.toolTip1.ToolTipTitle = "Titled ToolTip";
        // pictureBox2
        this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.pictureBox2.Location = new System.Drawing.Point(148, 24);
        this.pictureBox2.Name = "pictureBox2";
        this.pictureBox2.Size = new System.Drawing.Size(100, 50);
        this.pictureBox2.TabIndex = 1;
        this.pictureBox2.TabStop = false;
        this.toolTip2.SetToolTip(this.pictureBox2, "This is a tooltip.");
        // Form1
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(279, 107);
        this.Name = "Form1";
        this.Text = "ToolTip Test";
  static void Main()
    Application.Run(new Form1());


Do write a comment if this code is helpful for you ...

Technorati Tags: , , , ,

Wednesday, October 10, 2007

Multithreading Using C#


Multithreading has always been a helpful friend of a programmer . Multithreading increases the response time of an application .  Multithreading can be implemented by using namespace system.threading  .

Why Multithreading is required ?

> For this I will give U a simple example : Assume U have a company and U have only one assistance and 0 workers then what will happen the complete workload of company will be on your assistance , the assistance then take much time to do everything one by one , Which will affect U in turn .. your application also runs in the same manner if U have only single thread Your execution and your processing will be very slow which may also hangs your application . So Multithreading distributes specified process to run in another thread  an wont affect the normal processing of your application ..

Lets have a little demo for this .

Demo - 1


using System;
using System.Threading;
public class MyThread
    public static void Thread1()
        for (int i = 0; i < 10; i++)
            Console.WriteLine("Thread1 {0}", i);
    public static void Thread2()
        for (int i = 0; i < 10; i++)
            Console.WriteLine("Thread2 {0}", i);
public class MyClass
    public static void Main()
        Console.WriteLine("Before start thread");
        Thread tid1 = new Thread(new ThreadStart(MyThread.Thread1));
        Thread tid2 = new Thread(new ThreadStart(MyThread.Thread2));

Explanation :

In this Demo u have 2 static methods Thread1 and Thread2 . To make a thread we are making a object class named Thread.

The constructor of this class takes a reference of a ThreadStart class. This constructor
can send two types of exceptions; ArgumentNullException when the parameter is
a null reference or a Security Exception when program does not have permission to
create thread.


The parameter of the Thread class is reference to a ThreadStart class.
ThreadStart class points to the method that should be executed first when a
thread is started. The parameter is the name of the function, which is considered as
a thread function. Thread1 is a static function so we give it with the name of class
name without making an object of the class. The thread starts execution with
Start() method of the Thread class. The output of this program is

Before start thread
Thread1 0
Thread1 1
Thread1 2
Thread1 3
Thread1 4
Thread1 5
Thread1 6
Thread1 7
Thread1 8
Thread1 9
Thread2 0
Thread2 1
Thread2 2
Thread2 3
Thread2 4
Thread2 5
Thread2 6
Thread2 7
Thread2 8
Thread2 9

This is how we using multithreading in our application ...

Technorati Tags: , ,

Friday, October 5, 2007

Improving BitTorrent Download Speeds

1.0 Why are my downloads going slow?

- 1.1 Reason 1: Your ISP is limiting your download speed
- 1.3 Reason 2: You have a “NAT Error”
--> 1.3.1 How do I know if I have this problem?

2.0 Fixing a NAT error

- 2.1 Switch off UPnP
- 2.2 Configure Your XP Firewall (ICF: Internet Connection Firewall)
--> 2.2.1 Configure ICF in SP1
--> 2.2.2 Configure ICF in SP2
- 2.3 Configure Your Router
- 2.4 Configure Microsoft Internet Connection Sharing (ICS)
- 2.5 Configure Your Firewall.

3.0 Multiple BitTorrent users on a LAN
4.0 Other things that could be wrong

1.0 Why are my downloads going SOOO slow?

1.1 Reason 1: Your ISP is limiting your download speed

Some ISPs are limiting download speeds by controlling the bandwidth allocated to traffic using the default BitTorrent ports, which are 6881 to 6999.

This is not just a problem for those who have nasty ISPs, it affects everybody. To avoid ISPs from damaging the efficiency of a torrent with their controls, some stringent tracker owners are blocking users trying to connect on the standard ports.

So whether your ISP is limiting you or not, all BitTorrent users should stop using the default ports.

For simplicity, this guide recommends the use of port 16881. Adding a 1 to the start is simple administratively, and is in a range unlikely to be used by other programs.

You then need to set up your client to use the new port.

Tools -> Options -> Connection
-> Add a “1” before the current listen port number. For example, 6881 will now be 16881.

2) uTorrent
Options -> Preferences -> Connection
-> Type 16881 for the port number for incoming connections. Untick the box for Randomize Port.

Whatever client you use, make sure you update anywhere else you have entered the port numbers to account for the change.

By completing this section, you have helped to avoid problems later down the line, but this will not solve the majority of slow downloads. Therefore, move on to reason 2.

1.2 Reason 2: You have a “NAT Error”

BitTorrent works on a credit system. By uploading parts of a file to other people, they allow you to download parts of the file from them. This is BitTorrents anti-leech measure. However, if you have a problem with your NAT (anything between you and the internet, such as a router or firewall), you will not get credit for what you are uploading. The only downloading that you can do is from people who upload a small amount to you in the hope that you will return the favour. Since their client will not recognise your response if you have a NAT problem, then they will stop uploading to you shortly after. This is what is causing your problem. You may also notice that torrent speeds go very high for 5 minutes, before slowing back down to 0-5kb/s.

1.2.1 How do I know if I have this problem?

You might not have a problem at all. Before continuing with this guide, leave your torrent running for at least ten minutes. If the speed hasn't picked up, stop and restart the torrent. If that fails, try at least two other torrents. If you are still having problems, continue on...

Start to download a file using your chosen client.

Wait a while for the torrent to get started; this may take up to five minutes.
Look in the “Health” column. If it is showing a yellow spot, then you need to configure your firewall/NAT/router. If it is Green then all is OK. Your slow downloads are being caused by something else.
A full list of the different colours can be seen []here[/url].

Azureus can also check your configuration for you.
Select “Tools” -> “NAT / Firewall Test”
The default TCP listen port is 6881. If you have changed the listening port, enter the new port in the “Incoming TCP Listening Port.”
Press “Test”
If the result is “NAT Error,” please continue with the guide.
If the result is “OK”, then your slow speeds are being caused by something else.

PLEASE NOTE: The Azureus checker can report a false NAT error if you are running PeerGuardian or Protowall. Make sure these are disabled before using the Azureus wizard.

Wait a while for the torrent to get started; this may take up to five minutes.
On the status bar, look for either a yellow warning triangle, or a green dot. If there is a yellow warning triangle, then you need to configure your firewall/NAT/router. If it is green then all is OK and your slow downloads are being caused by something else.
uTorrent can also check your configuration for you.
Select “Options” -> “Speed Guide…”
Check the current port is set to the port used in the first section, i.e. 16881.
Click “Test if port is forwarded properly”.
If you get an error, then continue to follow this guide. If the port is correct set up, then skip to the section 4.0 – “Other things that could be wrong”.

2.0 It’s showing yellow / warning triangle, I have a NAT error – what do I do?

You need to configure your computer and/or network to accept incoming BitTorrent port connections. The tracker port is 6969. If this port is not correctly configured, downloads will not start at all. The download/upload ports used in this guide are 16881-16889. It is these ports that are causing your problems.

2.1 Disable UPnP

Universal Plug and Play (UPnP), it is a feature that works with some compatible routers to open the required ports automatically. However, some routers, even if they are compatible with UPnP, have problems with this.

Tools -> Options
Expand "Plugins" on the left hand tree.
Select "UPnP"
Deselect "Enable UPnP"

Options -> Preferences -> Connection
Deselect “Enable UPnP port mapping”.

2.2 Configure Your XP Firewall (ICF: Internet Connection Firewall)

Please go to the appropriate sub-section.
- “Configure ICF in SP1” if you have NOT installed Service Pack 2
- “Configure ICF in SP2” if you have installed Service Pack 2

2.2.1 Configure ICF in SP1

Open up your “Network Connections”. Right click on your internet connection or LAN connection and select “Properties”.
->Select the “Advance” tab
->If the “Internet Connection Firewall” is not ticked, then this is not your problem. Research into whether you need the XP firewall or not and jump to "Configure Your Router" below. If it is ticked, please continue:
->Click “Settings…”
->On the “Services” tab press “Add…”
->Description of service = BitTorrent
Name or IP address of the computer hosting this service on your network = (this means "the local machine.")
External Port number for this service = 16881
Internal Port number for this service = 16881
-> Press OK.

-> With uTorrent, make sure Options -> Preferences -> Connection -> "Port used for incoming connections” is equal to 16881.

-> With AZUREUS, make sure that "Tools -> Options -> Connection -> Incoming TCP Listen Port" is equal to 16881.

Check if the torrent/health has gone green. If not, move on to section 2.2.

2.2.2 Configure ICF in SP2

-> Open your Windows Control Panel and select “Security Centre.”
-> Scroll down to the “Manage security settings for:” section and select “Firewall”
-> Decide whether you want to keep the firewall on or off. Make an informed decision based on more than the information provided by Microsoft. If you decide to switch it off, then do so and move onto section 2.2. Otherwise, continue this section.
-> Select the “Exceptions” tab.
-> Select “Add Port…”
-> Name: = BitTorrent (or anything of your choice)
-> Port number: = 16881
-> Press OK.

-> With uTorrent, make sure Options -> Preferences -> Connection -> "Port used for incoming connections” is equal to 16881.

-> With AZUREUS, make sure that "Tools -> Options -> Connection -> Incoming TCP Listen Port" is equal to 16881.

Restart the client and wait five minutes. Check if the health has gone green or that the warning triangle has vanished. If not, move on to section 2.3.

2.3 Configure Your Router

If you are on a LAN with a router or hardware firewall, you may need to configure it. You need to forward BitTorrent’s connection ports to your specific PC on the LAN.

If your connection is shared using Microsoft Internet Connection Sharing (ICS), go to section 2.3.

There are too many routers to cover in this guide, so it is time to head to Google. Search for port forwarding, BitTorrent and the name of your router. Lots of manufacturers provide specific information on their sites. A generic guide to port forwarding for most routers can be found at

-> With uTorrent, make sure Options -> Preferences -> Connection -> "Port used for incoming connections” is equal to 16881.

-> With AZUREUS, forward port 16881. Make sure this matches "Tools -> Options -> Connection -> "Incoming TCP Listen Port"

Restart the client and wait five minutes. Check if the health has gone green or that the warning triangle has vanished. If not, move on to section 2.4.

2.4 Configure Microsoft Internet Connection Sharing (ICS)

If you are sharing an internet connection using ICS, then you will need to forward the BitTorrent ports.
Windows 2000 users, click here for information on forwarding (mapping) ports.

Other users:
Shock Systems used to provide a useful tool called “ICS Configuration” for changing the settings of ICS to allow full BitTorrent access to a second computer.

-> Install the program on the serving computer and run it
-> Click “+ Add”
-> Name = [whatever you want, e.g. BitTorrent]
-> Target = Local IP of machine running BitTorrent, e.g.
-> Description = [whatever you want, e.g. “allow BitTorrent for”]
-> On the “Ports” tab, slect “+ Add”
-> Select “Port Range” from the drop-down box
-> Enter “16881” and “16889” into the relative boxes
-> Data translation = NORMAL
-> Press “OK”, Press “Enable”, Press “OK”.
-> Close everything and reboot the PC.
The settings will be saved in your registry. There is no need to open ICS Configuration with ICS.

-> With uTorrent, make sure Options -> Preferences -> Connection -> "Port used for incoming connections” is equal to 16881.

->With AZUREUS, forward port 16881. Make sure this matches "Tools -> Options -> Connection -> Incoming TCP Listen Port"

Restart the client and wait five minutes. Check if the health has gone green or that the warning triangle has vanished. If not, move on to section 2.5.

2.5 Configure Your Firewall

As with routers, there are too many to cover here, so time to head to Google. Unlike with other sections to this guide, ports only have to be opened, rather than forwarded.

With both AZUREUS and uTorrent, open port 16881.

3.0 Multiple BitTorrent users on a LAN

The same port can not be forwarded to different computers, so decide who gets which ports, for example: = 16881 = 16882 etc.

Set up your router or ICS to forward the ports to the chosen computers.

Now you need to set up the BitTorrent Clients:

Each computer only needs one port forwarded to it.
-> Tools -> Options
-> "Connection" on the side menu
-> On “Incoming TCP Listen Port” enter the port number that is being forwarded to that computer. Taking from the above example, computer would enter 16884.
-> Repeat for all the users

Options -> Preferences -> Connection -> is equal to 16881.
-> Set "Port used for incoming connections” to the port number that is being forwarded to that computer. Taking from the above example, computer would enter 16884.
-> Press “OK”
-> Repeat for all users.

4.0 Other things that could be wrong

Try limiting your upload if you have ADSL/DSL. Sometimes BitTorrent can try to upload so much that it floods your upload, making it difficult for incoming connections. explains further:

It might seem strange to hear that your upload speed can directly affect your download speed, but it can, and quite dramatically. The reason behind it is based on the way the Internet works. When you download a file (or in this case, chunks of a file), your computer sends a tiny message back to the source computer, called an ACKnowledgement packet. These ACK packets tell the source computer that chunk #1 has arrived OK, please send #2. When #2 is down, it sends another, and so on. The source computer will not send #3 until it gets the ACK from #2. It uses a small amount of your upload bandwidth to do this. This works fine when downloading files off the Internet, but with P2P, you tend to upload as well.

This is especially true with BitTorrent – because you upload as well. If done efficiently, downloads can be very fast. The problem lies with the fact that you upload *so much* that the ACK's do not get sent out fast enough, which slows your download. The simplest way to solve this is to limit your upload bandwidth. 80% of the maximum is usually recommended, but I find I can set it to 90% with no adverse effects. This gives your ACKs a bit of breathing space to get out with.
CCSDUDE makes this recommendation on limiting your upload:

"Try 11kbs up as your limit on a 128k upload package...double it for 256/1.5mb lines and keep going up as you hit 384/ect. That seems to be the sweet spot on BT. Enough to keep everyone happy whilst not slowing your downloads down or slowing your surfing.
Some ISPs recognise BitTorrent traffic and then limit it. Simply switching to Azureus or uTorrent will mean that you traffic will be encrypted between compatible clients. Without giving technical details, this will stop ISPs from recognising the traffic as being from BitTorrent."

Improving BitTorrent Download Speeds

Technorati Tags: , , ,

Monday, October 1, 2007

Who Else Wants To Make Money With Adsense?

Fact number 1: Kids in high school are making thousands of dollars every month with Adsense.

Fact number 2: Housewives, retirees, mom and dads, who are just staying at home and have never made a dime on the internet have created full-time incomes by simply placing Adsense ads on their web site or blog.
These are just some of the “super Adsense earners”. You may have already heard about their story for they are among the few who are on their way to making millions worth of cash just by promoting Adsense sites.

Anyone, any age and gender can become money generating Adsense publishers as long as they what it takes. How does one go about this Internet advertising?
Writing articles for Adsense is the way to do it. Using the right keywords in your articles and having Google ads on a certain site has become the most profitable way of marketing that anybody can get into. No experience and level of education needed. If you are not using this strategy, or may not be aware of it in the first place, chances are you may be losing thousands of dollars worth of extra income and still do not know it yet.

This is one of the many reasons why writing original quality content articles is now the latest in marketing buzz. Content and links. When combined together becomes a really powerful tool to a successful web site and richer individuals. Many internet marketing professionals are already aware of the value of an original quality content and how using keywords can drive targeted traffic into their sites from the search engines.

So why don’t all these web site owners write and submit their own articles if that is what is important?
The simple and understandable answer is that it takes time to write articles, submit them and get targeted traffic to their websites. That is why they get the services of those who can spares sometime to write the articles that would cater to their site purpose but still turn out as a good quality and unique piece of work.

To get into the Adsense marketing business and start earning some good cash, ask yourself. Did you enjoy writing when you were in school? If you answer yes to this question, you already have an initial advantage over most internet marketing business owners that wants to make money online and doing it at home.

With the boom in the Adsense market comes the need for sites to want fresh, quality and original keyword rich content. This way, web site owners can have a steady supply of articles with the proper keywords that they relate to their site contents. The result of this is seen in the sites page rank when indexed by the search engines. Which, in turn, gets moreAdsense ads to show above, below or next to the article on their website with targeted traffic.
What do people have to do?

Write quality and original content, keyword or phrase rich articles with links to your website in the resource box. Then build a website or web page with targeted keyword or phrase rich original content for the targeted traffic that originates from the articles you wrote. Finally, you will have a Google Adsense ads that are targeted to your keyword or phrase rich original content site where visitors will get to visit when they come looking for information.

A win-win situation if you think more about it. A favor for persons looking for quality content and information. For the persons writing the original content articles. And the person with the quality original content rich website. Of course, the search engines and its advertisers are getting targeted traffic and sales but so what? As long as you are getting something in your favor, it does not really matter what the others are getting for themselves.

So who else wants to start earning money with Adsense. You. Everyone. Anybody. Internet marketing has many opportunities wide open for this people. Writing articles and using Adsense for your kind of internet marketing strategy is one sure way of getting a

piece of that action and cash.
Better not be left behind the many making millions already.