A Knight’s Watch

Recently I came across this interesting problem through Toptal (on Codility) which kept me thinking hard for a few days. Finally, I now have a solution to this problem and would like to share it here. Problem: Basically, the problem deals with a knight piece on an infinite chess board. Assuming the knight is positioned […]

Read More

Get Random Date From A Date Range

This is a quick trick to generate a random date between two date ranges. First, create a function that generates a random number between two given values: private static int RandomNumBetween(int smallNum, int bigNum) { Random rnd = new Random(); int randomValue = rnd.Next(smallNum, bigNum + 1); return randomValue; } Now, use this function to […]

Read More

C# : Write DataTable To CSV

Here’s a quick code to write data from database to a CSV format file in C# .NET. I find this function really useful as I frequently come across this scenario where I have to create a report for the client. Once our data is loaded into a DataTable, this function can be used. public static […]

Read More

Visual Studio: Converting a Class Library to Portable Class Library

Before you even start asking GOOGLE about how to convert a Class Library Project to Portable Class Library (PCL) in Visual Studio, why don’t you try to do it by yourself? In fact that is the best approach for this scenario because if you try to google for the solution, you will realize that none […]

Read More

SQL: Get Database Name From Physical Name

Here’s a SQL Function to get name of the database from it’s physical full name. This function can be used in conjunction with RESTORE FILELISTONLY which can generate physicalname,  the parameter of this function, from a database’s backup file. You can read more about RESTORE FILELISTONLY here. create function get_db_name_from_physical_name (@physicalname varchar(500)) returns varchar as […]

Read More

SQL: Save Result From RESTORE FILELISTONLY

RESTORE FILELISTONLY is a Transact Statement in MS-SQL that returns a result set containing a list of the database and log files contained in the backup set in SQL Server. Basically it contains meta-data pertaining to the database’s: LogicalName PhysicalName Type Size MaxSize etc. This information is quite useful when performing Restore operation. For example, […]

Read More

Becoming An Indie Game Developer From A Programmer Background

As Wikipedia defines it, “Independent video game development is the video game development process of creating indie games; these are video games, commonly created by individual or small teams of video game developers and usually without significant financial support of a video game publisher or other outside source.” While both game development and regular software […]

Read More

Freelance Developers Now Earn Through Writing

Since popular freelancing sites are overrated, today I would like to share with you guys one another way to generate extra income. Freelance Writing! Get paid to write articles and tutorials. There are tons of sites on the internet that are craving for excellent content to be published on their sites. Writers In Charge lists […]

Read More

SQL Pivot with Dynamic Column Names

Found a great solution to writing a complex PIVOT function in SQL on the web! The solution was lying on a thread at one of the ASP.NET forums where the question was: “how to display row values in columns in sql server 2008“ and the solution was provided by M. Atif Nadeem from Pakistan. He […]

Read More

Checklist For Xamarin Forms Development

Here’s a list to help you get started with cross-platform mobile app development using Xamarin Forms. Xamarin Visual Studio 2015 Android SDK Windows 10 OS While you can work with Windows 8 as well, you will need Windows 10 operating system if you are going to develop for Windows 10 Universal App. Mac with Xcode […]

Read More

Upwork Sucks Big Time!

I am not much of a hater and I hardly say these kind of stuff about anyone (specially in public), but this time I have to make an exception. Yes guys, like the title says: UPWORK sucks !! Yes www.upwork.com, the freelancing site for freelancers, just sucks! Why? Ok the main reason for my hatred […]

Read More