Tag: tricks
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 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.
Using NOT operator to inverse the condition in SQL Server
Imagine a scenario where you want to retreive records that you dont want. You can use the NOT operator to reverse the search condition. For example , You want to get all the departments having the GroupName other than ‘Research and Development’. The other way of getting the same result is using the != in every condition.
How to Generate C# class from a XML file ?
Do you want to generate C# class from an XML file ?. You can use the xsd tool to do it. How to Generate C# class from a XML file ? 1. Just launch the Visual Studio Developer Command prompt from the Windows Start menu. 2. Type the command xsd and specify the path of the xml file. xsd d:\test\test.xml 3. This will create the…
How to Declare a variable in SQL Server ?
You will most likely declare a variable in the SQL Server and use it in the SQL Statements. You can use the DECLARE statement and specify the variable and datatype and optionally provide a default value. For example , You can declare an NewEmployeeJobTitle variable using the DECLARE statement and provide a default value as ‘Chief Executive Officer’ DECLARE @NewEmployeeJobTitle nvarchar(50) = ‘Chief Executive Officer’;…
How to Declare and Define an unsigned short data type variable in F# ?
How to Declare and Define an unsigned short data type variable in F# ?
How to Open Network Connections from Command line in Windows 10 ?
You can use the ncpa.cpl command to open the network connections from command line in Windows 10. How to Open Network Connections from Command line in Windows 10 ? Just open the command window and type ncpa.cpl and press the enter key to open the network connections dialog. Alternatively , the ncpa.cpl command can also be used in the Run window. Press Windows + R…
How to Declare and Define an Short data type variable in F# ?
How to Declare and Define an Short data type variable in F# ?
How to Check if a login exists in SQL Server ?
If you need to check if a login exists in SQL Server , you can use query the master.dbo.syslogins for it. How to Check if a login exists in SQL Server ? Here’s a sample query demonstrating how you can query master.dbo.syslogins to find out if the login exists in SQL Server. This would retreive all the details of the loginid ‘sa’.
How to Declare and Define an String data type variable in F# ?
How to Declare and Define an String data type variable in F# ?
How to Save a Stream to a File in C# ?
Below is a sample code snippet that demonstrates how to save a stream to a file in C#. How to Save a Stream to a File in C# ?
How to change positive numbers to negative in Microsoft Excel 2016 ?
Do you want to change the positive numbers to negative numbers and vice versa (or in simple terms) , reverse the sign of the numbers in Microsoft Excel 2016 ?. This blog post will provide you a simple tip on how to do it using the Paste special function. How to change positive numbers to negative in Microsoft Excel 2016 ? 1. Type the number…
C# 6.0 feature – Lambda Expression in Function Members
C# 6.0 lets the developers to use lambda expression as function member . For example , instead of the function body , you can write the lambda expression directly as shown below. C# 6.0 feature – Lambda Expression in Function Members
Using BETWEEN clause to specify range of values in SQL Query
In SQL Server 2014 , you can use the BETWEEN clause to specify a range of values in the search criteria. How to specify a range of values in a Query in SQL Server ? For example , you want to to query the Employee table to display the employees having the birthdate between 1969-01-29 and 1975-12-01′ , you can use the BETWEEN clause as…