h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Microsoft Team Foundation Server

Microsoft Team Foundation Server- TFS Source Control System
Its some kind of tool like SVN/GIT etc source version control system.But, version control is only a part of this.Team foundation server(in short, TFS), is a great innovation of Microsoft,that is integrated with Visual Studio and provide a easy/effective way to manage a software development project completely.
Installing:
If you are using visual studio 2008, then you must need to have service pack 1 installed before you can install team foundation client software.
you can download the team system client for vs 2008 from this microsoft download link.
If you are a visual studio 2010 user, then you won’t have to do anything and its already a part of visual studio 2010.
Configuring:
         First we will have to connect to TFS server and setup the initials.
        On visual studio menu, you should see a menu named ‘Team’, which will include only one option titled ‘Connect To Team Foundation Server’.From here, you will get an ‘Connect To Team Project’ dialogue.
This originally contains the listing of team projects on a selected server. As we don’t have any server configured, there will be nothing here at this moment.
Click on the ‘Servers’ button.
         Here, you can provide the url, port, extra uri path,protocol(http/https). However, instead of giving individual details, if you give a complete url that contains all info, will work also. This can be like “http://yourtfsserver.com:8080/uripath”.
           After you have added the server. select it on “Connect to Team Project” dialogue.
Now, select proper ‘Project Collection’ and then select your specific project.Then you should be prompt to select a local pc directory where you wish to save all the files.it will perform a complete ‘checkout’ operation that will download all latest files from the server.
Browse Server Contents:
           There are two windows to get you see the server files.
           First, On ‘View -> Team Explorer’ you will see the team foundation server’s all items like Work       Items,Documents,Reports,Builds and Source Control.The main concern for us at this moment is to use the ‘Source Control’ part.If you click on that option, you will get to another new window, which actually shows you all server files inside your team foundation server project.
Adding/Deleting Files/Directories To Source Control:
            You should be able to see some options on the top bar of source control explorer window.
Similar options will be found if you right click of your mouse inside the area.
To add one/more file(s)(or directories), just use the ‘Add Items To Folder’ option to do so. Here,
I want to add a suggestion that, although you will be able to select files from other directories as well,it will be best to, first add items to your local file system (relatively) where you want them to be placed on server. then add the add option on source control explorer to add them from there.
           After you perform the addition, those files/directories won’t be committed to server yet.
You will then have to perform another operation named ‘Check In Pending Changes’ to add them permanently to tfs server(its similar to the commit option on SVN).
          Similarly you can delete files/folders from server using the ‘delete’ option and then finally checking in the pending changes.Here, just to mention, remove something using the source control explorer will not necessarily remove them from your local file system.You can do it manually.
Edit File:
          To Edit a file, you should first use the option ‘Checkout for edit’ to acknowledge server that you are going to edit this file.This will be notified to other developers also and they will see this in edit mode through source control explorer.Also, until you checkout a file for edit, files will be in ‘read only’ mode.
As a result, you won’t be able to edit it externally(However its still possible to do so from within visual studio).
So, checking out for edit is kind of must for binary files(like doc file etc) at least.
Also, if you edit a file in offline mode(not connected to tfs server), it will detect the edited files and will convert them to ‘edit’ mode after you get to online.
Merging And Branching:
           TFS has merging and branching facility as well.If your local version doesn’t fit with server version, in short, if any conflicts occurs, you can either manually merge them in merge tool or you can command tfs to do auto merge(you will only get this option if TFS thinks that it can be merged automatically).
            If you have to work on several files and all are related to a single feature, its best to create a branch of the project or code file(s) and work on them. After finishing your task. you can again use the TFS merge command with the main branch and it will automatically incorporate those changes itself.Finally, you will have to commit as well.
Shelve Set:
         If you are a earlier SVN user, then you may be new to this term.Team foundation server has this feature, which allows you to save your local edit as a separate item in server,which can be retrieved and reviewed by other developers of your team. After approval suggestions, it can be deleted or check in to the main version control stream.
Refer

Create Constructor in VB.Net

This is code for Constructor in VB.Net
private idx As Integer
    Public Sub Class1(ByVal id As Integer)
        Me.idx = id
    End Sub

.NET Framework Application Essentials


  • Working with Base Types
  • Collections and Data Structures
  • Generics in the .NET Framework
  • Handling and Raising Events
  • Handling and Throwing Exceptions
  • File and Stream I/O
  • Dates, Times, and Time Zones
  • Programming with Application Domains and Assemblies
  • Serialization [from BPUEDev11]
  • Resources in Desktop Apps
  • Globalizing and Localizing .NET Framework Applications
  • Accessibility
  • Extending Metadata Using Attributes
  • 64-bit Applications


Override ToString Method in VB.Net

This is a Example for Override ToString Method in VB.Net

Public Class Class1
    Public idx As Integer
    Public Overrides Function ToString() As String
        Return Me.idx.ToString() + " " + "VB.Net"
    End Function
End Class
Paste this following code in your main form  
        Dim cl As Class1 = New Class1
        cl.idx = 100
        MessageBox.Show(cl.ToString())
Result:
100 VB.Net

Override ToString Method in C#.Net

This is a Example for Override ToString Method in C#.Net

To Create a Class File for Convert a integer into string

        private int idx;
        public Class1(int idxs)
        {
            this.idx = idxs;
        }
        public override string ToString()
        {
            return this.idx.ToString() + " " + "Good";
        }
Paste this following code in your main form
   Class1 cls = new Class1(10);
            MessageBox.Show(cls.ToString());

Output:
10 Good

Aware of the Body Language you should know before your next job interview

Aware of the Body Language you should know before your next job interview
Here are 11 basic facts on body language which might help you a lot while preparing yourself for job interviews.
Most of us aren't aware of our body language, especially when we're in a stressful situation — but interviewers are trained to read it.
It is important to have body awareness before you go into an interview, In fact, there are many actions and habits that we should consider doing or avoid doing to tell the right story during the interview setting.
1. Feel good about your wardrobe and wear clothes that 'show you in your best lighting'.
2. Place your feet on the floor.
3. Sit still or you'll come off as a nervous person.
4. Place your hands on your knees.
5. Sit a bit forward to show that you're interested and serious about the interview.
6. Folding your arms will make you seem unfriendly.
7. Playing with your hair or cracking your knuckles can be extremely distracting to your interviewer.
8. Putting your hands in your pockets makes you look 'messy'
9. Don't invade the interviewer's space and keep your hands and body parts on your side of the desk
10. Use props to help you look more comfortable
11. Staring will make you look too intense and unnatural.
In a conversation, never fully lock eyes with people. Bentley said. We talk, we look people in the eyes, we have a thought, and we look away. We look to the right, and we look to the left. When you start staring at them, you start "to look a little crazy. If you feel like you are looking the person in the eye too long, hold it one more second and break away.
The above are only a few basic tips on body language "Do's and Don'ts" for a job interview. You can easily acquire them if you take a little conscious step ahead.
Hope, you enjoyed reading this post.
Have a great day

From FB.

Add DataGridView Column Value in C#.net

Today, we will discuss about Add DataGridView Column Value in C#.net
private double  ADDCoulmnValue(int ColIdx, DataGridView dgv)
        {
            double d = 0;
            for (int idx = 0;idx <dgv.Rows.Count;idx++)
            {
                tot += Convert.ToDouble(dgv.Rows[idx].Cells[ColIdx].Value);
            }
            return tot;
        }

Add DataGridView Column Value in VB.Net

Today,We will see "How to Add DataGridView Column Value in VB.NET?"
Private Function ADDCoulmnValue(ColIdx As Integer, dgv As DataGridView) As Double Dim d As Double = 0 For idx As Integer = 0 To dgv.Rows.Count - 1 tot += Convert.ToDouble(dgv.Rows(idx).Cells(ColIdx).Value) Next Return tot End Function

Fetch Text File data into Datagridview in VB.Net

Today we will see Fetch Text file Data into Datagridview in VB.net
Text file Data Format
111;222
333;444
555;666
777;888
Code:
private Sub DispaydatafromTextFile(txtFilePath As String) '1st you must create columns to dgv, like: dataGridView1.Columns.Add("col1", "Column1") dataGridView1.Columns.Add("col2", "Column2") 'and so on... Using sr As New StreamReader(txtFilePath) Dim row As Integer = 0 Dim line As String While (InlineAssignHelper(line, sr.ReadLine())) IsNot Nothing Dim columns As String() = line.Split(";"C) dataGridView1.Rows.Add() For i As Integer = 0 To columns.Length - 1 dataGridView1(i, row).Value = columns(i) Next row += 1 End While End Using End Sub
Private Sub button1_Click(sender As Object, e As EventArgs) DispaydatafromTextFile("C:\Test.txt") textBox1.Text = Convert.ToString(dataGridView1.CurrentRow.Cells(0).Value) textBox2.Text = Convert.ToString(dataGridView1.CurrentRow.Cells(1).Value) End Sub
Private Sub dataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) textBox1.Text = Convert.ToString(dataGridView1.Rows(e.RowIndex).Cells(0).Value) textBox2.Text = Convert.ToString(dataGridView1.Rows(e.RowIndex).Cells(1).Value) End Sub

Fetch Text File Data into Datagridview in C#.Net

Today ,we will discuss about how to fetch data from Text File into Datagridview in C#.net
Text File Data Format
111;222
333;444
555;666
777;888
Code 
private void DispaydatafromTextFile(string txtFilePath)
 {
 //1st you must create columns to dgv, like:
 dataGridView1.Columns.Add("col1", "Column1");
 dataGridView1.Columns.Add("col2", "Column2");
 //and so on...
 using (StreamReader sr = new StreamReader(txtFilePath))
 {
 int row = 0;
 string line;
 while ((line = sr.ReadLine()) != null)
 {
 string[] columns = line.Split(';');
 dataGridView1.Rows.Add();
 for (int i = 0; i < columns.Length; i++)
 {
 dataGridView1[i, row].Value = columns[i];
 }
 row++;
 }
 }
 }
 private void button1_Click(object sender, EventArgs e)
 {
 DispaydatafromTextFile(@"C:\Test.txt");
 textBox1.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[0].Value);
 textBox2.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value);
 }
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
 textBox1.Text = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
 textBox2.Text = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells[1].Value);
 }

Find existing Item in ComboBox in C#.net

Today we will see "Find Existing Item in ComboBox in C#.net"

Code
private void ComboBox1_Leave(System.Object sender, System.EventArgs e)
{
int resultIndex = -1;
resultIndex = ComboBox1.FindStringExact(ComboBox1.Text);
if (resultIndex > -1) {
MessageBox.Show("Found It");
}
else
{
MessageBox.Show("Did Not Find It");
}
}

Find existing item in ComboBox in Vb.net

Today we will discuss about Find existing item in Combobox in VB.Net

Private Sub ComboBox1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.Leave
Dim resultIndex As Integer = -1
resultIndex = ComboBox1.FindStringExact(ComboBox1.Text)
If resultIndex > -1 Then
MessageBox.Show("Found It")
Else
MessageBox.Show("Did Not Find It")
End If
End Sub

Define ViewBag in MVC

Define ViewBag in MVC
ViewBag is used to pass data from a controller to the view.ViewBag object holds the data.

Define Helper Classes

Define Helper Classes
There are several Helper classes in MVC frame work. 
1.Form Helper- Radio buttons, textboxes,list boxes etc.
2.URL helpers
3.HTML helpers- Encode, Decode, AttributeEncode, and RenderPartial.

Define Non-Action Methods

Define Non-Action Methods

  • All action methods in a Controller are defined as public method.
  •  If you want some method as non action method,mark the method with NonAction Attribute.

Define Action Methods Parameters

Define Action Methods Parameters

  • Request and Response methods can be called from the action method of the controller.
  • If the parameter to an action method is passing through the URL, there are several ways to access it into our action method.

Define MVC Attributes

Define MVC Attributes

  1. Attribute is a class which inherites from the abstract class System.Attribute.
  2. All attributes should end with the name "Attribute".

Define ActionResult Return Type

Define ActionResult Return Type

  1. Creating new controllers, they will come with one or more actions by default.
  2.  The Empty controller includes an Index action with a return value of type ActionResult.
  3.  ActionResult class is the base class for all action results.

Define Action methods

Define Action methods

  • User gives request to the controller via URL. 
  •  The Controller processes the requests using the action methods defined by the Controller. 

Define Types of Action Filters

Define Types of Action Filters
1. Authorization filters 
       Implements the IAuthorizationFilter attribute. This filter is always executed first. 
2. Action filters
       Implements the IActionFilter attribute. You can use this filter to modify the viewdata that an action returns.
3. Result filters 
       Implements the IResultFilter attribute. Eg You might want to modify the view result before view is redered to the browser.
4. Exception filters
       Implements the IExceptionFilter attribute. Can be used to log errors, raised by your controller action or controller action results.

Use Row_number() in SQL Server

SQL Scenario -I

Table A Table B
Id Id
1 1
2 -
- 3
4 4
Expected Output:
Id Description
1 1 Has both in tables
2 2 Has in A table Only
3 3 Has in B table Only

4 4 Has both in tables.

create view UV_Result
as
select a.id,a.id + '  ' + 'Has both in tables' as [DESCRIPTION] from table1 a,table2 b where a.id=b.id and a.id<>'-'

Create view UV_TestA
as
select Distinct id as [TableAID],
      RowNum = row_number() OVER (ORDER BY (SELECT 0))
from  table1 a
   
Create view UV_TestB
as
 select   id,
     RowNum = row_number() OVER (ORDER BY (SELECT 0))
from     table2


create view uv_Final
as
select id,DESCRIPTION from UV_Result
union ALL
select rownum,CONVERT(varchar(50),CONVERT(bigint,rownum)) +' ' + 'HAS TABLE B'  from UV_TestA where TableAId='-'
UNION ALL
select rownum,CONVERT(varchar(50),CONVERT(bigint,rownum)) +' ' + 'HAS TABLE A'  from UV_TestB where Id='-'

select * from uv_Final order by id

Define MVC Action Filters

Define MVC Action Filters
Action Filters are used in cases where we need to perform some logic either before an action method is called or after an action method runs.

Use of System.XML.XLINQ

It contains classes to provide functionality to LINQToXML

Use of System.Data.DLINQ

Provide functionality to Work with LINQToSQL.

Qualifiers in LINQ

They are LINQ Extension Methods return Boolean Value.

  1. All
  2. Any
  3. Contains
  4. SquenceEqual



Main Components in LINQ

There are three Main Components in LINQ

  1.  Standard Query Operator
  2.  Language Extension
  3.  LINQ Provider

add Minutes to DateTime in Sql Server

We can use DATEADD() function like below to add minutes to DateTime in Sql Server. DATEADD() functions first parameter value can be minute or mi or n all will return the same result. Below example shows how we can add two minutes to Current DateTime in Sql Server:

SELECT GETDATE() 'Now',
           DATEADD(minute,2,GETDATE()) 'Now + 2 Minutes'
SELECT GETDATE() 'Now',
           DATEADD(mi,2,GETDATE()) 'Now + 2 Minutes'
SELECT GETDATE() 'Now',
           DATEADD(n,2,GETDATE()) 'Now + 2 Minutes'

add Hours to DateTime in Sql Server

                We can use DATEADD() function like below to add hours to DateTime in Sql Server.                
                DATEADD() functions first parameter value can be hour or hh all will return the same result. Below example shows how we can add two hours to Current DateTime in Sql Server:

SELECT GETDATE() 'Now',
           DATEADD(hour,2,GETDATE()) 'Now + 2 Hours'
SELECT GETDATE() 'Now',
           DATEADD(hh,2,GETDATE()) 'Now + 2 Hours'

add Seconds to DateTime in Sql Server

               We can use DATEADD() function like below to add seconds to DateTime in Sql Server. DATEADD() functions first parameter value can be second or ss or s all will return the same result. Below example shows how we can add two seconds to Current DateTime in Sql Server:

SELECT GETDATE() 'Now',
           DATEADD(second,2,GETDATE()) 'Now + 2 Seconds'
SELECT GETDATE() 'Now',
           DATEADD(ss,2,GETDATE()) 'Now + 2 Seconds'
SELECT GETDATE() 'Now',
           DATEADD(s,2,GETDATE()) 'Now + 2 Seconds'

IIF funciton in SQL Server 2012 and give an Example

If you are using SQL Server 2012 you can use IIF and get the same effect as CASE statement.

Create a Table
CREATE TABLE SimpleTable (ID INT, NAME VARCHAR(10))
GO
Insert some value into table
INSERT INTO SimpleTable (ID, NAME)
SELECT 1, 'LAKSHMI'
UNION ALL
SELECT 2, 'NARAYANAN'
UNION ALL
SELECT 3, 'NARAYANAN'
GO
UPDATE SimpleTable
SET Gender = IIF(NAME = 'NARAYANAN', 'LAKSHMI', 'NARAYANAN')
GO
SELECT *
FROM SimpleTable
GO

Example for CASE Function in SQL

Create a Table
CREATE TABLE SimpleTable (ID INT, NAME VARCHAR(MAX))
GO
Insert some value into table
INSERT INTO SimpleTable (ID, NAME)
SELECT 1, 'LAKSHMI'
UNION ALL
SELECT 2, 'NARAYANAN'
UNION ALL
SELECT 3, 'NARAYANAN'
GO
CASE Funciton
UPDATE SimpleTable
SET Gender = CASE NAME WHEN 'NARAYANAN' THEN 'LAKSHMI' ELSE 'NARAYANAN' END
GO
SELECT *
FROM SimpleTable
GO

Example for REPLACE Function in SQL

Create a Table
CREATE TABLE SimpleTable (ID INT, Gender VARCHAR(10))
GO
Insert some value into table
INSERT INTO SimpleTable (ID, Gender)
SELECT 1, 'female'
UNION ALL
SELECT 2, 'male'
UNION ALL
SELECT 3, 'male'
GO

Replace male into female using UPDATE Query
UPDATE SimpleTable
SET Gender = REPLACE(('fe'+Gender),'fefe','')
GO
SELECT *
FROM SimpleTable
GO

SQL SERVER – 2005 – Find Stored Procedure Create Date and Modified Date

SELECT name, create_date, modify_date
FROM sys.objects
WHERE type = 'P'
AND name = '<Sp_name>'