Tag: How to
How to get the Relative Server Path in ASP.NET Web API ?
In ASP.NET MVC , we can use the Server.MapPath or Request.MapPath to get the relative path of the server for a file. For example , The fileName would be the absolute path of the file. How to get the Relative Server Path in ASP.NET Web API ? You can use the HostingEnvironment.MapPath defined in System.Web.Hosting to get the relative path of the file as shown…
How to get the column names from a SqlDataReader in C#?
There are times when you might want to connect to a database and then get all the column names that was returned in the SqlDataReader object. How to get the column names from a SqlDataReader in C#? Here’s a code snippet demonstrating how to do it.
How to convert number to text in Excel?
In Microsoft Excel 2016 , there are times when you don’t want the numbers present in the cell to be participating in the calculation. This means , you can either update the formula to not include the cell value or else change the number to text. How to convert number to text in Microsoft Excel 2016? You can use the TEXT function in Excel to…
C Program to display half-pyramid using numbers
Problem Write a program in C to print half-pyramid using numbers as shown.The program should take the number of rows as input. 1 1 2 1 2 3 1 2 3 4 How to create and display half-pyramid pattern in C using numbers? Output Abundantcode.com Coding samples Enter the No. of rows:4 1 1 2 1 2 3 1 2 3 4
How to Detect Windows Phone OS version using C#?
The Windows Phone SDK provides the Environment.OSVersion property which can be used to detect the version of the Operating System uses in Windows Phone (Windows Phone 8 / Windows Phone 7). Below is a code snippet that demonstrates how to detect the Windows Phone OS Version using C#. How to Detect Windows Phone OS version using C#?
How to Check if all elements in array are alphabets in JavaScript ?
JavaScript provides the every() method defined in the Array object which lets the developers to check and validate the contents of the array in JavaScript. How to Check if all elements in array are alphabets in JavaScript ? Below is a sample code snippet demonstrating the usage of the every() method to find out if all the elements in the array are alphabets. Note that…
What is the equivalent of MySQL’s Now() function in SQL Server ?
MySQL has the function Now() which is a Datetime type field which shows the current date as well as the time. What is the equivalent of MySQL’s Now() function in SQL Server ? In SQL Server , you can use the GetDate() function to achieve the same.
How to change the ‘Edit Top 200 Rows’ in SQL Management Studio ?
When working with the SQL Server Management Studio and trying to edit the table records , you would have noticed the context menu option “Edit Top 200 Rows”. How do you change this to display all the records for editing instead of “Edit top 200 rows” in the context menu ? There are couple of ways in which you can do it. 1. Right click…
How to sort an array using Comparator in Java ?
The Arrays.sort method in java lets the developers to sort an array of objects. The sort method also accepts the comparator object which can contain the sorting logic. How to sort an array using Comparator in Java ? Below is a sample code snippet demonstrating the usage of the Arrays.sort method with the comparator.
How to select unique names from a List using LINQ in C#?
Below is a sample code snippet demonstrating on how to get unique or distinct names from a list in C# using LINQ query. How to select unique names from a List using LINQ in C#?
Preventing the Orientation from being changed in Windows Phone App
The PhoneApplicationPage has the property Supported Orientation which is used to restrict the orientation of the page in a Windows Phone App. It accepts the values Portrait Landscape PortraitOrLandScape How to Prevent the Orientation from being changed in Windows Phone App? Setting the Supported Orientation to Portrait, Landscape will restrict the orientation from being changed when the windows phone device is rotated. If the Supported…
How to Navigate from One Page to Another in Windows Phone 8 using Hyperlink Button?
Below is a sample code snippet demonstrating how to navigate from a page to another in Windows Phone 8 using Hyperlink Button. How to Navigate from One Page to Another in Windows Phone 8 using Hyperlink Button? Assume that the current page in “MainPage.xaml” and the “ACCode.xaml” is the destination page. One can use the code XAML <HyperlinkButton Content=”GoToAC” NavigateUri=”/ACCode.xaml” HorizontalAlignment=”Left” Margin=”73,292,0,0″ VerticalAlignment=”Top” Height=”57″ Width=”244″…