Tag: tips

FSharp Interactive Commands

FSharp Interactive UI includes few good number of commands which can be used by the F# Developers . Below are some of the FSI Commands which can be used by the developers. FSharp Interactive Commands Cancel Interactive Evaluation – This option cancels the execution of the FSI . Reset Interactive Session – This option resets the execution of the current FSI . Cut – This…

How to get specific columns from a Table in SQL Query ?

If you want to get the data from the specific columns from a table in your database , you can specify them in the query. For example, This would return the data of all the columns available in the Department table. If you want to get the data of the specific columns from the Department table , you can specify the column names in the…

Case insensitive string comparison for Contains in C#

When using the string.contains method , the comparison is done based on the exact string that is passed as parameter. In this case , the comparison is case-sensitive. using System; namespace ACConsoleApp { class Program { static void Main(string[] args) { string input = “This is a WeLcome string”; var output = input.Contains(“Welcome”); Console.WriteLine(output); Console.ReadLine(); } } } In the above code snippet , the…

Navigate from One Page to Another in Windows Phone 8 using NavigationService

When developing a WP8, you may encounter a scenario where you need to navigate from one page to another within your application. The PhoneApplicationPage’s class has the property NavigationService which can be used to navigate from one page to another. The NavigationService exposes the Navigate method which loads the specified windows phone application page . Navigate from One Page to Another in Windows Phone 8…

How to Get the List of Appointments from the Calendar App in Windows Phone using C# ?

If you want to programmatically get the list of appointments from the calendar application of your Windows Phone device programmatically , you can use the Microsoft.Phone.UserData.Appointments. How to Get the List of Appointments from the Calender App in Windows Phone using C# ? Enable the ID_CAP_APPOINTMENTS in the WMAppManifest file and then create an instance of the Appointments class and call the SearchAsync method with…

Anonymous Types are read-only in C#

If you try to set a value to the anonymous type in C# , you will receive an compiler error . The properties within the anonymous types are read-only properties. Anonymous Types are read-only in C# In the above code snippet , you will receive an compiler error “Error    CS0200    Property or indexer ‘<anonymous type: string FirstName, string Last>.FirstName’ cannot be assigned to — it…

Undefined reference to `pow’ when compiling C program

When trying to make a simple program in C and compiling it , there are times when you might get an error that you are missing the pow function when you have used them inspite of including the math.h header file. The error message looks like this. undefined reference to ‘pow’ collect2: error: ld returned 1 exit status How to fix the error undefined reference…

Verify if the variable is a non-empty string in JavaScript

If you want to test if a variable that is defined is a non-empty string in JavaScript , you can use the typeof keyword to find if the type is a sring as well as check for the length of the string as shown below. How to verify if the variable is a non-empty string in JavaScript ? This will cause the else part to…

How to handle Null Column values of SQLDataReader in C# ?

If you want to handle the Null column values of the sqldatareader object in C#, you can use the SqlReader.IsDBNull method to validate for it. If the SqlReader.IsDBNull returns true then , the value is considered to be a null value and you can take the ction accordingly. How to handle Null Column values of SQLDataReader in C# ?

How to Get a value to a Variable in SQL Server ?

When you use the declare a variable using the DECLARE statement. The same variable can be used to store a value retrieved from the database and later can be used in your SQL Query. How to Get a value to a Variable in SQL Server ? For example , you want to retreive the value of the column JobTitle and store it in the variable…

How to Get the Desired Accuracy Level of Location using Geolocator in Windows Phone 8?

There are 3 different technologies that help the phone get the current location of the phone. These include Wifi, Cellular and A-GPS. Each one of these technologies has their own advantages and disadvantages in terms of the power consumption and the accuracy level. The Geolocator class allows the developers to specify at what level of accuracy or technology to be used to find the location…

How to return the SHA1 hash value of a string in SQL Server ?

SQL Server provides a function HashBytes function that returns the SHA1 , MD2 , MD4 and few other hash value of the specified input. How to return the SHA1 hash value of a string in SQL Server ? Just pass the ‘SHA1’ as the first parameter and the input as second parameter value to the HashBytes function to get the SHA1 hash value.

SQL Server – Saving changes is not permitted. The changes you have made require the following tables to be dropped...

There are times when you get an error stating “Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can’t be re-created or enabled the option Prevent saving changes that require the table to be re-created.” You can easily resolve this issue by following the steps mentioned…

How to Derive a Class (Inheritance) in Javascript (WinJS) ?

If you want to derive a class from another class in Javascript when developing a Windows store app using WinJS library , you can use the WinJS.Class.derive method to do it. How to Derive a Class (Inheritance) in Javascript (WinJS) ? Below is a sample code snippet demonstrating how to derive a class in WinJS.