Tag: tips
Example of Property Elements in Xaml
The Syntax for the property element in Xaml is as follows below TypeName.PropertyName The property elements are always contained inside a typename object and they don’t have the attributes of their own. An example of the property element is the Button.Content property which is used to set the content of the button control which is of type object. The Below code is used to set…
using IN clause to provide a list of values for Search Criteria
In SQL Server , you can use the IN clause to providing the list of values for a search criteria. For example , you want to display the employee records who’s job title is one of the following : ‘Design Engineer’,’Tool Designer’. The above query uses the IN clause to filter the employee records using the arbitrary list of values. Alternatively , you can also…
C Program to print a Half Pyramid using *
Problem Write a program in C to print Half pyramid using * as shown. * * * * * * * * * * * * * * * How to create and display Half Pyramid pattern in C ? Output Abundantcode.com Coding samples Enter the total number of rows: 5 * * * * * * * * * * * * * *…
Types of Strings in F# Triple Quoted , Verbatim , Normal
There are 3 different types of Strings available in F# Types of Strings in F# 1. Normal String 2. Verbatim String @ 3. Triple Quoted String Below is a sample code demonstrating these 3 different types of strings in F#
Exit the Current Scope without returning a value in SQL Server
You can use the RETURN statement to discontinue the execution of a the T-SQL batch statement. For example , you want to display the Employees whose MaritalStatus is Divorced. You donot want the SQL Statements following it to be executed if this condition doesn’t match. You can use the IF NOT EXISTS and use the RETURN statement as shown in this example. The second statement…
Example of Anonymous Method in C#
Below is a sample code snippet that demonstrates how to use anonymous method to add two numbers in C#. Example of Anonymous Method in C#
How to check if one string contains another substring in JavaScript ?
Below is a sample code snippet that demonstrates how to check if one string contains another specified substring using JavaScript. How to check if one string contains another substring in JavaScript ?
Inner Join in SQL Server
You can use inner join to get the result of two tables that match the criteria. For example , assume that you have a Person table and a Phone Number table where every person would have 0 or more phone number associated to him and you wish to get the person records who have at least one phone number. Here’s the query on how to…
How to check if a column exists in a table in SQL Server ?
If you want to find out if a column exists in a SQL Server table , you can use the sys.columns table and specify the name of the column and table as parameter. How to check if a column exists in a table in SQL Server ? For example , you want to find out if the GroupName column exists in the table “HumanResources.Department” table…
Sleep Command in SQL Server
If you are looking at writing a query to sleep for or WAIT for a certain amount of time before the query execution can begin , you can use the WAITFOR command. For example , if you want to wait for 1 minute , the query or command for the same will be this.
Specify a port number when connecting to SQL Server in Management Studio
There are times when you want to connect to a SQL Server instance that is running on a different port number than default port (1433). How to specify a port number when connecting to a SQL Server instance in SQL Management Studio ? Just specify the SQL Server instance that you are connecting to along with the port number with comma as delimiter. For example…
How to remove or replace array element in JavaScript ?
To remove or replace an element in an array in JavaScript , you can use the splice method as shown below. How to remove or replace array element in JavaScript ? To remove the array element , you can use the splice method and specify the index of the array to remove the array element. The second parameter determines the number of elements to remove….
How to mark a file as read-only from command line in Windows 10 ?
You can set a file to a read-only mode from the command line by using the command attrib and passing in the parameters like the read-only mode and the name of the file. The format of this command is as follows attrib +R <Name of the the file> How to mark a file as read-only from command line in Windows 10 ? For example ,…
How to embed Rectangle inside a Button in Xaml ?
Below is a sample code demonstrating how to embed a rectangle inside a Button in Xaml . How to embed Rectangle inside a Button in Xaml ?
How to Get the Current Location in Windows Phone 8?
The Windows Phone 8 SDK provides the Geolocator class which can be used to monitor and get the current location from Windows Phone 8. The Geolocator API is part of the WinPRT API and contains the necessary events for detecting the changes in the Geographic position of the Windows Phone. Below is a sample soucrecode demonstrating how to get the Current Location in Windows Phone…
How to get the list of all tables from a SQL Server database ?
If you need to get the list of all tables from a SQL Server database , you can query the information_schema.tables by specifying the TABLE_TYPE parameter search criteria to “BASE TABLE’. How to get the list of all tables from a SQL Server database ?
Sorting the Data in a Query in SQL Server
You want the results of the query to be displayed in a sorted order based on some query. In this case , you use the ORDER BY clause in the query by specifying the column on which the sort to work. For example , you want to sort the Departments table in the database by the column DepartmentName. Here’s how the query looks like This…
How to repeat a string N number of times in C# ?
Do you want to repeat a string N number of times in C# ? . You can use the string.concat and Enumerable.Repeat to achieve it in .NET Framework 4.0 and higher. How to repeat a string N number of times in C# ?
How to stretch ListBox Items horizontally to full width of the ListBox in Xaml ?
If you want the list items to horizontally stretch to full width of the ListBox in Xaml , you can set the HorizontalContentAlignment property to the value as shown below. How to stretch ListBox Items horizontally to full width of the ListBox in Xaml ? Below is a sample code snippet demonstrating the usage of the ItemContainerStyle of the Listbox to set the Style.
How do you check if an index exists in a table?
You can find out if the index exists for a table by querying the sys.indexes table as shown in this blog post’s code sample. How do you check if an index exists in a table? This will list out all the indexes of the table.