Search This Blog

Sunday, September 15, 2013

SQL Server 2012 Services

Services are applications that start without user interaction, normally at computer startup.
Main services in SQL Server 2012:

SQL Server 2012 database engine is responsible for executing commands submitted in the
Transact-SQL, T-SQL, language, database management, memory and disk allocation.

SQL Server Agent is responsible for executing scheduled jobs, monitoring the system and other administrative tasks.

Business intelligence include SQL Server Reporting Services, SQL Server Analysis
Services, and SQL Server Integration Services.





Friday, September 13, 2013

View File Extensions Windows 7

Windows 7 > View File Extensions

By default Windows 7 hides the file extensions of known file types in Explorer views.
To view the file extensions:

Click Start and type folder






Open Folder Option and on View tab and uncheck Hide extensions for known file types



Tuesday, September 10, 2013

Bit Data Type SQL Server

SQL Server > Data Types > Bit

Bit is an integer data type that can take a value of 1, 0, or NULL.
 
Example: Use bit data type to set user is admin or not


CREATE TABLE #Users(
  [Name]  [nvarchar](50) NOT NULL,
  [Admin] [bit] NOT NULL
)

ALTER TABLE [#Users] ADD CONSTRAINT [DF_Users_Admin] DEFAULT ((0)) FOR [Admin]
GO

insert into #Users(Name, Admin) values ('Admin',1), ('John',0)

select * from #Users where Admin = 1
drop table #Users

Result:

Name   Admin
Admin  1






Monday, September 9, 2013

Windows 7 and Windows Server 2008 R2 Service Pack 1

Service Pack 1 for Windows Server 2008 R2 and Windows 7 provides ongoing improvements to the Windows operating system.

Click here to download Windows 7 Service Pack 1





Thursday, July 18, 2013

Indexers C#

C# > Indexers

Indexers enable to create a class that client applications can access as an array.
Implementation: encapsulate an internal collection or array.





Example:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        class Test
        {
            private string[] mStr = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "K"};
            public int Length
            {
                get { return mStr.Length; }
            }
            // Indexer declaration.
            public string this[int index]
            {
                get
                {
                    return mStr[index];
                }
                set
                {
                    mStr[index] = value;
                }
            }
        }
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            Test t = new Test();
            //  indexer set accessor
            t[1] = "a";
            t[2] = "b";
            //  indexer get accessor
            for (int i = 0; i < t.Length -1 ; i++)
            {
                MessageBox.Show(t[i]); 
            }
        }
     }
}

 





Asc Method Visual Basic

VB.NET > Functions > ASC

Asc Method returns an Integer value of character code corresponding to a character.

Example:

Dim IntCode As Integer
IntCode = Asc("A") '65
IntCode = Asc("a") '97
IntCode = Asc("@") '64
IntCode = Asc("?") '93





CType Function Visual Basic NET

VB.NET > Functions > CType

CType function returns the result of explicitly converting an expression to a specified data type.

Example:

Public Class Form1
  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim mStr As String = "100"
    Dim mInt As Integer = CType(mStr, Integer) 'convert "100" string to mInt = 100 OK

    mStr = "aaa"
    mInt = CType(mStr, Integer) ' Error: Conversion from string "aaa" to type 'Integer' is not valid. NOK
  End Sub
End Class