Skip to main content

Restore a Database Backup in MS SQL Server 2008

· One min read

How to Restore a Database Backup Using .bak file in MS SQL Server 2008

.bak files are database backups we can restore the Database backup using SQL Server Management Studio.

A. Open SQL Server Management Studio in Object Explorer Right Click on 'Databases' Node and select 'Restore Database'

B. 'Restore Database' Dialog will be displayed on the General page

  1. The name of the restoring database appears in the To database list box. To create a new database, enter its name in the list box.

  2. Select 'From device'

  3. Click button to display 'Specify Backup' Dialog

  4. Click 'Add'  to browse the .bak file from the directory and click OK

Change the name of the Debug Version of a DLL or Exe

· One min read

Its very useful to name the Debug version of the exe or DLL with letter "D" appended in-order to avoid confusion between release and debug version of binaries

Steps:

  1. Create a console application with name "MyProject"

  2. To change the output file name in debug configuration

place D as shown in below figure

Project Project Properties -> Linker -> General -> Output File

Release Version: MyProject Application Name: c:MyProjectReleaseMyProject.exe Debug Version: MyProject Application Name: c:MyProjectDebugMyProjectD.exe

Reading a file using JavaScript

· One min read

To read a file from the browser used the below sample code.

 function ReadFile(filename) {
try {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fh = fso.OpenTextFile(filename,1);
var contents = fh.ReadAll();
fh.Close();
return contents;
} catch (Exception) {
var msg = "ERROR:"+"""+filename+ """+ ": " +Exception.description; alert(msg);
return msg;
}
}

WPF SnippetManager

· One min read

FEATURES

  • To use a snippet:  Drag the title of the snippet to the desired target app.

  • In order to move the app around: Drag the black bottom portion of the window.

  • The topmost checkbox and load/close buttons will work as expected.

Link to complete article SnippetManager

C FAQ

· One min read
  1. How to write a code to count number of characters/Spaces/numbers/special characters present in a sentence.  sentence ="1. GOD IS GREAT !!!"

2. How to insert space between each character in a sentence. sentence ="GOOD MORNING" newsentence = "G O O D  M O R N I N G"

Click here to read complete Article

Tags:

MFC: Fill the Client area with a bitmap

· One min read

In MFC to fill the client area with a bitmap use the following code.

BOOL CMySDIView::OnEraseBkgnd(CDC\* pDC)
{
CDC mymem;
//Create a dc to represent display surface
mymem.CreateCompatibleDC(pDC);

CBitmap bmp;
bmp.LoadBitmap(IDB\_MYBITMAP);
mymem.SelectObject(&bmp);

//BitBlt Copy bitbamp from source (mymem) to destination (pDC)
pDC->BitBlt(0,0,740, 520, &mymem,0,0, SRCCOPY);

return TRUE; // CView::OnEraseBkgnd(pDC);
}

MFC: Fill Client area with a desired color

· One min read

MFC Tip: To fill the Background of the client area with a desired color keeping the text in the client area unchanged

BOOL CMySDIView::OnEraseBkgnd(CDC\* pDC)
{
CRect r;
//GetClientRect gets the width & height of the client area of
//the window
GetClientRect(&r);
CBrush br(RGB(255,250,100));
pDC->SelectObject(br);
pDC->FillRect(r,&br);

return TRUE;
}

Interactive MDX Post

· One min read
NBT
Sr. Software Architect

Blog posts support Docusaurus Markdown features, such as MDX.

tip

Use the power of React to create interactive blog posts.

<button onClick={() => alert("button clicked!")}>Click me!</button>