Tuesday, January 22, 2013

How to check for a invalid format of date entry in SQL

In old days and even today many of the programmers declare date filed as varchar in database.
which leads to many invalid entries in the database and incorrect execution of the program.

We can either check at code level before inserting if the date is valid or invalid by ISDATE() Function

Or if we dont do it and there are already couple of wron entries in the DB the Hell starts for the coder to find where exactly the Bug is.

Either we go one by one row or we might check len(date)>8
which gives the dates like 12/121/1985 or 12/12/12895
it could be other way as well like /1/1982.
The Simple way to debug what i think is try to convert the date and see where the issue comes like.

select convert(datetime, date ,103) as DOB,* from TableName

Thsi will give you all the rows and stop immediately after encounntering error .

Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.

Just go to the result pane and then check the last row it showed and broke. You will notice that the culprit is the next ID or date solve it and go ahead !  
This was a solution which i use to trouble shoot. please comment if you have a better one.

Sunday, January 20, 2013

Different types of Testing /Quality Assurance


What’s Ad Hoc Testing ?
A testing where the tester tries to break the software by randomly trying functionality of software.
What’s the Accessibility Testing ?
Testing that determines if software will be usable by people with disabilities.
What’s the Alpha Testing ?
The Alpha Testing is conducted at the developer sites and in a controlled environment by the end user of the software

What’s the Beta Testing ?

Testing the application after the installation at the client place.
What is Component Testing ?
Testing of individual software components (Unit Testing).
What’s Compatibility Testing ?
In Compatibility testing we can test that software is compatible with other elements of system.
What is Concurrency Testing ?
Multi-user testing geared towards determining the effects of accessing the same application code, module or database records. Identifies and measures the level of locking, deadlocking and use of single-threaded code and locking semaphores.
What is Conformance Testing ?
The process of testing that an implementation conforms to the specification on which it is based. Usually applied to testing conformance to a formal standard.
What is Context Driven Testing ?
The context-driven school of software testing is flavor of Agile Testing that advocates continuous and creative evaluation of testing opportunities in light of the potential information revealed and the value of that information to the organization right now.
What is Data Driven Testing ?
Testing in which the action of a test case is parameterized by externally defined data values, maintained as a file or spreadsheet. A common technique in Automated Testing.
What is Conversion Testing ?
Testing of programs or procedures used to convert data from existing systems for use in replacement systems.
What is Dependency Testing ?
Examines an application’s requirements for pre-existing software, initial states and configuration in order to maintain proper functionality.
What is Depth Testing ?
A test that exercises a feature of a product in full detail.
What is Dynamic Testing ?
Testing software through executing it. See also Static Testing.
What is Endurance Testing ?
Checks for memory leaks or other problems that may occur with prolonged execution.
What is End-to-End testing ?
Testing a complete application environment in a situation that mimics real-world use, such as interacting with a database, using network communications, or interacting with other hardware, applications, or systems if appropriate.
What is Exhaustive Testing ?
Testing which covers all combinations of input values and preconditions for an element of the software under test.
What is Gorilla Testing ?
Testing one particular module, functionality heavily.
What is Installation Testing ?
Confirms that the application under test recovers from expected or unexpected events without loss of data or functionality. Events can include shortage of disk space, unexpected loss of communication, or power out conditions.
What is Localization Testing ?
This term refers to making software specifically designed for a specific locality.
What is Loop Testing ?
A white box testing technique that exercises program loops.
What is Mutation Testing ?
Mutation testing is a method for determining if a set of test data or test cases is useful, by deliberately introducing various code changes (‘bugs’) and retesting with the original test data/cases to determine if the ‘bugs’ are detected. Proper implementation requires large computational resources
What is Monkey Testing ?
Testing a system or an Application on the fly, i.e just few tests here and there to ensure the system or an application does not crash out.
What is Positive Testing ?
Testing aimed at showing software works. Also known as “test to pass”. See also Negative Testing.
What is Negative Testing ?
Testing aimed at showing software does not work. Also known as “test to fail”. See also Positive Testing.
What is Path Testing ?
Testing in which all paths in the program source code are tested at least once.
What is Performance Testing ?
Testing conducted to evaluate the compliance of a system or component with specified performance requirements. Often this is performed using an automated test tool to simulate large number of users. Also know as “Load Testing”.
What is Ramp Testing ?
Continuously raising an input signal until the system breaks down.
What is Recovery Testing ?
Confirms that the program recovers from expected or unexpected events without loss of data or functionality. Events can include shortage of disk space, unexpected loss of communication, or power out conditions.
What is the Re-testing testing ?
Retesting- Again testing the functionality of the application.

What is the Regression testing ?

Regression- Check that change in code have not effected the working functionality
What is Sanity Testing ?
Brief test of major functional elements of a piece of software to determine if its basically operational.
What is Scalability Testing ?
Performance testing focused on ensuring the application under test gracefully handles increases in work load.
What is Security Testing ?
Testing which confirms that the program can restrict access to authorized personnel and that the authorized personnel can access the functions available to their security level.
What is Stress Testing ?
Stress testing is a form of testing that is used to determine the stability of a given system or entity. It involves testing beyond normal operational capacity, often to a breaking point, in order to observe the results.
What is Smoke Testing ?
A quick-and-dirty test that the major functions of a piece of software work. Originated in the hardware testing practice of turning on a new piece of hardware for the first time and considering it a success if it does not catch on fire.
What is Soak Testing ?
Running a system at high load for a prolonged period of time. For example, running several times more transactions in an entire day (or night) than would be expected in a busy day, to identify and performance problems that appear after a large number of transactions have been executed.
What’s the Usability testing ?
Usability testing is for user friendliness.
What’s the User acceptance testing ?
User acceptance testing is determining if software is satisfactory to an end-user or customer.
What’s the Volume Testing ?
We can perform the Volume testing, where the system is subjected to large volume of data.

Thursday, January 17, 2013

Failed to install key pair — Object already exists error

The problem is that you cannot delete a key and you cannot add the key. This is because you do not have access to the key to delete it and the .NET framework cannot add it because of constraints on the StrongName data store.


The solution is to give yourself access to C:\Documents and Settings\AllUsers\ApplicationData\Microsoft\Crypto\RSA\MachineKeys\. This allows proper functioning when you run "sn.exe -d" allow it to remove the StrongName.


Here is an example sequence of commands:

C:\>sn -d someKey

Microsoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573

Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Failed to delete container 'someKey' -- Unable to format error message

8013141C


The key container must still exist because I cannot create a new key

container, the error message is as follows:


C:\Projects\dload\Assembly>sn -i "C:\Keys.snk" someKey


Microsoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573

Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.


Failed to install key pair -- Object already exists.



The hack to fix this is:



Browse to %SystemDrive%\Documents and Settings\AllUsers\ApplicationData\Microsoft\Crypto\RSA\MachineKeys

Grant rights to Adminstrators, or whatever group you belong to

Take Ownership of this folder (click Advanced under Security, and then click the Ownership tab at the top)

Apply the changes to the children ("Replicate permission...")

Then Try sn- d {KeyName}
Bingo ! and then re-install your assembly by signing it sn -i {KeyName}

How To Solve: "No Files Were Found To Look In. Find Was Stopped In Progress"

Last week a co worker of mine who wanted to remain anonymous, ran into the weirdest problem. She tried to use the “find in files” option in Visual Studio 2012 and even though the searched expression was out there in one of the files, she got the following result: “No files were found to look in. Find was stopped in progress.”


You can close Visual Studio, restart your computer or jump three times on one leg, but the problem remains. This is a very strange and odd bug,

But fortunately there is a solution: press Ctrl+Scroll Lock and everything gets back to normal. If it doesn’t work, try to press Scroll Lock and than hit Ctrl+Scroll Lock again. I have no idea why or how it works, but the fact is that it does solve the problem.

Wednesday, January 9, 2013

Windows 7 Professional doesn't mount my usb flash drive anymore



Remove the INFCACHE.1 file, Perform the following steps to remove and rebuild the INFCACHE.1 file.
  1. Disconnect all USB deviced except the keyboard and mouse. (Desktop only) (Laptop remove all usb devices)
  2. Open Windows Explorer by right clicking on Start, and then clicking on Explore.
  3. In the address bar, type
    C:\Windows\System32\DriverStore
  4. Locate the INFCACHE.1 file, right click on it, and then click Properties.
  5. In the INFCACHE.1 Properties dialog box, click the Security tab, and then click Edit.
  6. In the User Account Control dialog box, click Continue.
  7. In the Permissions for INFCACHE.1 dialog box under the Group or user names section, click Add.
  8. In the Select Users or Groups dialog box in the Enter the object names to select text box, typeAdministrators, postfixed with a 's', and not only Administrator. If you only choose theAdministrator account you will not be able to delete the file. After that, click OK.
  9. In the Permissions for INFCACHE.1 dialog box in the Permissions for Administrators section, select to allow Full Control, and then click OK.
  10. In the INFCACHE.1 Properties dialog box, click OK.
  11. In the Windows Explorer window, delete INFCACHE.1, before deleting it, you can make a backup copy of this to another folder of you wish.
  12. Connect a USB device other than the one that Windows had trouble detecting. This forces Windows to rebuild the INFCACHE.1 file.
Note: This detection issue can happen several times in a row. If so, repeat steps 1-12 until the device is detected.

Saturday, January 5, 2013

Software testing basics