Aug 5, 2016

Marathi Keyboard v4.0 released on github

Virtual Keyboard Software to type in Devnagri script
Wrote C# code to map each key on keyboard with devanagari unicode font.

Source available on github:

  1. Type in marathi in any windows application easily using virtual keyboard software
  2. To switch between Marathi & Hindi language typing mode press "Ctrl+M"
 Key Mappings:
अ : A आ : a इ : i ई: I उ: u ऊ: U
ए: e ऐ: E ओ: o औ: O अं: N अ: : :
क : k ख : K ग : g घ : G ङ
च : c छ : C ज : j झ : jH ञ : Y
ट : T ठ : TH ड : D ढ : DH ण : nH
त : t थ : tH द : d ध : dH न : n
प : p फ : pH ब : b भ : bH म : m
य : y र : r ल : l व : v
श : sH ष : S स : s
ह : h ळ : L क्ष : x ज्ञ : Z
श्र: W ॐ : Q कृ: @
काना: a पहिली वेलांटी: i दुसरी वेलांटी: I पहिला उकार: u दुसरा उकार: U एक मात्रा: e दोन मात्रे: E

Download setup file:

Mar 16, 2015

C# Parse JSON into dynamic object

Parse JSON into dynamic object using Newtonsoft JSON library:
JsonReader jsonReader = new JsonTextReader(new StringReader(strText)) { DateParseHandling = DateParseHandling.None };
dynamic jsonObj = JObject.Load(jsonReader);

Mar 6, 2015

Electric Appliance Automation - An IoT Project using Windows Azure

I have started working on application Internet of things home automation using Windows Azure

In this article we’ll have look at controlling home appliances remotely over HTTP using a small API toolset we’ll create using ASP.NET web api. On top of that we’ll push the current device status to the client in real time with SignalR(windows service hosted)

We will Control following home appliances through windows service:
1. FAN - on/off, Speed adjust
2. Lights - on/off
3. Air Conditioner - on/off, Temperature Control
4. Speakers – on/off, Play/Pause/Stop song

Feb 20, 2015

Oct 17, 2014

How to implment CRON job in windows service using C#

In this post we will go throught the steps involved in creating a windows service which will repeat according to specified CRON EXPRESSION

1. Create a windows Service named "CronService"

2. Right click on the project in solution explorer, click on "Manage NuGet Packages"


3. Search for "Quartz.NET" and click on "Install" to install the package


4. Create a interface called "ITaskScheduler"

public interface ITaskScheduler
 string Name { get; }
 void Run();
 void Stop();
5. Create a class "TestTask" which inherits from "IJob" (IJob is an interface provided by, you need to import the "Quartz" namespace in this class)

public class TestTask : IJob
 public void Execute(IJobExecutionContext context)
  //Your main code goes here

6. Right click on the project in solution explorer, click on "Add Reference", select "System.Configuration" from .NET tab 

7. Add "TaskScheduler" class which will implement the above created interface "ITaskScheduler"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quartz;
using Quartz.Impl;
using System.Configuration;

namespace CronService
    public class TaskScheduler : ITaskScheduler
        private IScheduler _scheduler;
        public string Name
            get { return GetType().Name; }

        public void Run()
            ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
            _scheduler = schedulerFactory.GetScheduler();

            string taskGroup = "Test Group";
            string taskName = "Test Name";

            IJobDetail testJob = JobBuilder.Create()
                    .WithIdentity(taskName, taskGroup)

            ITrigger testTrigger = TriggerBuilder.Create()
                    .WithIdentity(taskName, taskGroup)

            var dictionary = new Dictionary>();
            //var dictionary = new Dictionary>();

            dictionary.Add(testJob, new Quartz.Collection.HashSet()

            _scheduler.ScheduleJobs(dictionary, false);

        public void Stop()

8. Add key in AppSettings section of app.config which will hold the Cron Expression

The current cron expression "0 0/15 * 1/1 * ? *" means that the service will run every 15 minutes.
Format of the cron expression is: [Minutes] [Hours] [Day of month] [Month] [Day of week] [Year]
You can get more information about cron expression from following page:
Cron Expression

You can obtain cron expression for your own schedule from following website:

Finally in your service's main class you need to write following code:
public partial class Service1 : ServiceBase
	ITaskScheduler scheduler;
	public Service1()

	protected override void OnStart(string[] args)
		scheduler = new TaskScheduler();

	protected override void OnStop()
		if (scheduler != null)
Please note that you need to write your code in the "TestTask" class's 'Execute' method and not in 'OnStart' method of your windows service.

How to find common words between two SQL variables

MSSQL How to find common words between two sentences:
CREATE FUNCTION [dbo].[EscapeXml](@data NVARCHAR(MAX))
 --< (<), & (&), > (>), " ("), and ' (')
 SELECT @t = REPLACE(REPLACE(REPLACE(REPLACE(@data,'<','<'),'&','&'),'"','"'),'''',''')
CREATE FUNCTION [dbo].[fnSplit](@data NVARCHAR(MAX), @delimiter NVARCHAR(5))
RETURNS @t TABLE (rowNum int IDENTITY(1,1), data NVARCHAR(max), descriptor varchar(255) NULL)
    SELECT @data = [dbo].[EscapeXml](@data)
    SELECT    @textXML = CAST('' + REPLACE(@data, @delimiter, '') + '' AS XML);

    INSERT INTO @t(data)
    SELECT  RTRIM(LTRIM(T.split.value('.', 'nvarchar(max)'))) AS data
    FROM    @textXML.nodes('/d') T(split)

SELECT as common
FROM dbo.fnSplit('This is sentence1 test',' ') sentence1 
INNER JOIN dbo.fnSplit('This is sentence2 test',' ') sentence2 ON =


Sep 16, 2014

Case insensitive Regex Relpace

Case insensitive Regex Relpace:
string source = "Hello India";
string expr = @"\b" + Regex.Escape("Hello") + @"\b";
source = Regex.Replace(source, expr, m =>
    return "World";
}, RegexOptions.IgnoreCase);
Replaces the word "Hello"|"hello"|"hELLO" with the word "World"