Thursday, December 26, 2013

Use of @(at the rate) in file path


  • In a string literal Prefixed with @ symbol the escape sequence appear as a normal character without being treated them differently.
  • For eg. @"C:\A\B\C" is same as "C:\\A\\B\\C" ,but first one looks a lot nicer.

Tuesday, December 24, 2013

Text to Speech in C#

First Add Reference:-System.Speech

NameSpace required:-using System.Speech.Synthesis

Code:-


Text Spammer in C#

Class and method used to implement Text Spammer:-

SendKeys Class:-Provides methods for sending keystrokes to an application.

Send Method:-Sends keystrokes to the active application.

Design Part:-






Code Behind Part:-




















Output:-





Note:-Below link is used to find code for keys to pass as an argument in the send method of sendkeys class.

http://msdn.microsoft.com/en-us/library/k3w7761b%28v=vs.71%29.aspx



Friday, December 20, 2013

Identity Vs Uniqueidentifier primary key


  • The reason why people suggest you avoid the unique identifier data type is complicated.  You need to understand how things work "behind the scenes".
  • First, let's investigate what happens with an integer key set to Identity(1,1).  Primary keys are implemented through indexes.  SQL Server stores index data on the hard drive.  All data is stored in 8 kilobyte pages (including indexes).
  • Now, an integer takes 4 bytes, so you can store roughly 2,000 values in an index page.  Data in an index is sorted, which is why index searches are so much faster.  Finally, consider what happens when you add a new value.  Since this is an identity column, the new value is guaranteed to be larger than any existing piece of data, so it will be added to the end of the list.  If the last data page is NOT full, SQL Server simply writes the data to the end of the last index page.  If the page happens to be full (which will only occur once every 2000 inserts), then a new page is allocated and the new value is written to the first spot if the newly allocated data page.
  • Now let's think about the uniqueidentifier primary key.  A uniqueidentifier requires 16 bytes per value, so the most you can fit in an 8K data page is 500 values.  This means your index will be 4 times larger simply because of the data type.  This also means that joins and searches will be slightly slower too.  It takes more time to compare a 16 byte value than it does to compare a 4 byte value.
  • More importantly, think about the data stored in the index. If you use NewId() to create your unique identifer, you can run in to some serious performance problems. Remember earlier I said that the data in an index is sorted.  This also holds true for unique identifiers.  NewId() will return a unique number which is likely to fall somewhere in the middle of your existing numbers. So.... when you insert a row, SQL needs to determine which data page to store the new value, then, if the data page is full, it must split the page in to 2 pages.  1/2 the data from the existing page is copied to the new page (leaving each page 1/2 full), and then the new value is inserted.  Even if the page isn't full, most of the time, the data in the page will need to be rearranged to accommodate the new piece of data (some of the rows will need to be pushed down so that the new value can be inserted in to the correct spot).
  • This problem occurs if you use the NewId() function for your unique identifier.  If you use the NewSequentialId() function, there is less of a problem because you are guaranteed to get a GUID that is greater than your existing values.  Your new value will be inserted at the end, and you won't have page splits to worry about.  You still have a 16 byte value to compare with other 16 byte values (instead of 4 byte integers), so your joins and filters will be slightly slower than if you had used integer keys.  
  • It's important to put this in to perspective.  If you have a table with 10's of millions of rows, with inserts, updates, and deletes occurring 100's or 1000's of times per second, then you really need to worry about this stuff.  With smaller tables that have less usage, it really doesn't matter because you will not notice the performance issues that this can cause.

Use of Rowguid in Sql Server

Rowguid:-

  • To ensure global uniqueness for the purposes of replicating the table using merge replication.
  • Row Guid is designed for make a row id unique  across, tables ,databases, or even databases  over network computers. 
  • Although the IDENTITY property automates row numbering within one table, separate tables, each with its own identifier column, can generate the same values. This is because the IDENTITY property is guaranteed to be unique only for the table on which it is used. If an application must generate an identifier column that is unique across the database, or every database on every networked computer in the world, use the uniqueidentifier data type and the NEWID (Transact-SQL) or NEWSEQUENTIALID() function. The Database Engine does not automatically generate values for the column. To insert a globally unique value, create a DEFAULT definition on the column that uses the NEWID() or NEWSEQUENTIALID() function to generate a globally unique value.

How to Create rowguid column??



Thursday, October 31, 2013

Microsoft SQL Server 2008, Implementation and Maintenance

MCSA : SQL Server 2008 70-432 TSQL Exam Paper with Solution

You work as a database administrator at ABC.com. ABC.com is planning to migrate a SQL Server 2000 application to SQL Server 2008 R2.After the migration, you want to keep an eye on the performance of the SQL Server 2008 R2 instance.   You then configure a SQL server-side trace that captures the Deprecation Announcement and Deprecation Final Support event classes.
Which two of the following best describes these two event classes respectively? (Choose two.)

A. The Deprecation Final Support event class reveals that a feature will be removed in the next important
release of SQL Server.
B. The Deprecation Announcement event class reveals that a feature will be removed in the next important
release of SQL Server.
C. The Deprecation Announcement event class reveals that a feature will be removed in an upcoming edition
of SQL Server.
D. The Deprecation Final Support event class reveals that a feature will be removed in an upcoming edition of SQL Server.

Correct Answer: AC

You work as a database administrator at ABC.com. ABC.com makes use of a SQL Server 2008 R2 instance that includes an On-Line Analytical Processing (OLAP) database.
The OLAP database hosts a dimension table, named ABCClients, which has hourly information updates configured. As a result, ABCClients has a large quantity of information that is no longer used. You have been instructed to make sure that the amount of space used by the ABCClients table is reduced with as little administrative effort as possible.
Which of the following actions should you take?
A. You should consider manually deleting the information that is no longer used.
B. You should consider making use of page compression.
C. You should consider making use of the Disk Cleanup Wizard.
D. You should consider making use of folder compression.


Correct Answer: B




Tuesday, October 22, 2013

How to move Application to Cloud

Move Application to Cloud


Application belongs to Adatum to keep a track, Submit and also the business process expenses. A datum’s policy is to submit their monthly Expenses to the Company for Reimbursement.
                                                             
Install the setup, open DependencyChecker.exe


When DependencyChecker.exe is clicked, it displays the list of pre requisites to be installed. Install all the Prerequisites




Now open the desired project
File -> Open -> Project/solution -> aExpense.sln



Now debug the project




After the Debug is started the output is then ready to appear in a browser


It now shows the site’s security certificate is not trusted!
Click Proceed anyway





Click on ADATUM\johndoe(Group: ‘Employee’)
Continue with login should be clicked



Enter DATE: TITLE:
Description,
 Amount,
In drop down select REIMB.METHOD as Cash and APPROVER ADATUM\mary
Add receipt by clicking browse



Adding Lunch and Dinner

 




OUTPUT:


Logging into manager’s role:
Manager can now login and review the reimbursements


He now has the authority to approve it


 
Worker can cross check it by logging into his account again