Programming Keys is blog for all Programming and technology related articles

Monday, March 27, 2023

Warning: Remote Host Identification Has Changed" IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY

This took place as a result of the fact that on March 24, 2023, GitHub updated the RSA SSH host key that is used to secure Git operations for GitHub.com because the private key was briefly exposed in a public GitHub repository. This was the reason why this occurred. If you remembered GitHub's previous key fingerprint in your SSH client prior to that date, you will receive that message. The solution, according to the linked blog post, is to run this command to get rid of the old key:
$ ssh-keygen -R github.com
Now, the next git connection (pull, push, or clone) should ask you if you trust the new SSH key. $ ssh-keygen -R github.com Utilizing the list, verify that the displayed new key is valid prior to entering yes: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
Share:

Monday, February 12, 2018

Quartz.NET 3.0.2 Configure AdoJobStore JobStore Sql server



Quartz.NET 3.0.2 Configure AdoJobStore JobStore SQL server


in the previous article, i have explained how to create jobs and triggers dynamically
this article will explain steps to configure quartz with SQL server

Step 1 : 

go to database\tables\tables_sqlServer.sql
and execute scripts in your SQL server DB you will see the list of tables 


Step 2 :

Open app.config and add quartz configuration settings


<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    </configSections>
  <quartz>
<add key="quartz.scheduler.instanceName" value="SchedulinginstanceName"/>
<add key="quartz.scheduler.instanceId" value="SchedulinginstanceId"/>


<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />


<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />

<add key="quartz.dataSource.default.connectionString" value="Server=yourhostname;Database=yourdatabasename;Trusted_Connection=True;"/>
<add key="quartz.dataSource.default.provider" value="SqlServer" />
<add key="quartz.serializer.type" value="json" />

</quartz>
</configuration>

Step 3 :

Install-Package Quartz.Serialization.Json -Version 3.0.0 


Step 4 : Create your scheduler in code

 var config = (NameValueCollection)ConfigurationManager.GetSection("quartz");
            return config;

ISchedulerFactory factory = new StdSchedulerFactory(config);
            scheduler = factory.GetScheduler().Result;
             scheduler.Start().Wait();

that's it you have successfully configured quartz with SQL server






Share:

Tuesday, January 30, 2018

Get all jobs and triggers details in Quartz.NET 3.0

in my Previous article I have explained how we can create jobs and triggers dynamically.in this article i will show you how we can get all running jobs and triggers in quartz.net 3.x

using Quartz;
using Quartz.Impl;
using Quartz.Impl.Matchers;

    class Program
    {
            var allTriggerKeys = scheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.AnyGroup());
            foreach (var triggerKey in allTriggerKeys.Result)
            {
             var triggerdetails =   scheduler.GetTrigger(triggerKey);
             var Jobdetails = scheduler.GetJobDetail(triggerdetails.Result.JobKey);

                Console.WriteLine("IsCompleted -" + triggerdetails.IsCompleted + " |  TriggerKey  - " + triggerdetails.Result.Key.Name + " Job key -" + triggerdetails.Result.JobKey.Name);
           
            }
}

kindly refere my Previous article for more understanding
Share:

Monday, January 29, 2018

Quartz.NET 3.0.2 Create Triggers and jobs dynamically

Quartz.NET is a pure .NET library written in C# and is a port of very popular open source Java job scheduling framework. let's see how we can create Triggers and jobs dynamically

using Quartz;
using Quartz.Impl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class JobsAndTriggers
    {
        public string jobIdentityKey { get; set; }
        public string TriggerIdentityKey { get; set; }
        public string jobData_MethodName { get; set; }
        public int ScheduleIntervalInSec { get; set; }
    }
    class Program
    {
        static void Main(string[] args)
        {
           List<JobsAndTriggers> LstobjJobsAndTriggers = new List<JobsAndTriggers>();
            LstobjJobsAndTriggers.Add(new JobsAndTriggers { jobIdentityKey = "JOB1", TriggerIdentityKey = "TRIGGER1", jobData_MethodName = "JOB1_METHOD()", ScheduleIntervalInSec = 5 });
            LstobjJobsAndTriggers.Add(new JobsAndTriggers { jobIdentityKey = "JOB2", TriggerIdentityKey = "TRIGGER2", jobData_MethodName = "JOB2_METHOD()", ScheduleIntervalInSec = 10 });


            TestDemoJob1(LstobjJobsAndTriggers).GetAwaiter().GetResult();

            Console.ReadKey();

        }
        public static async Task TestDemoJob1(List<JobsAndTriggers> lstJobsAndTriggers)

        {

            IScheduler scheduler;
            IJobDetail job =null;
            ITrigger trigger = null;

            var schedulerFactory = new StdSchedulerFactory();

            scheduler = schedulerFactory.GetScheduler().Result;

            scheduler.Start().Wait();

            foreach(var JobandTrigger in lstJobsAndTriggers)
            {

          //  int ScheduleIntervalInSec = 1;//job will run every minute

            JobKey jobKey = JobKey.Create(JobandTrigger.jobIdentityKey);



             job = JobBuilder.Create<DemoJob1>().
                WithIdentity(jobKey)
                .UsingJobData("MethodName", JobandTrigger.jobData_MethodName)
                .Build();



                trigger = TriggerBuilder.Create()

                .WithIdentity(JobandTrigger.TriggerIdentityKey)

                .StartNow()

                .WithSimpleSchedule(x => x.WithIntervalInSeconds(JobandTrigger.ScheduleIntervalInSec).WithRepeatCount(1)
               // .RepeatForever()
                )

                .Build();

                await scheduler.ScheduleJob(job, trigger);

            }

         

        }
    }
    public class DemoJob1 : IJob

    {

        public Task Execute(IJobExecutionContext context)

        {

            //simple task, the job just prints current datetime in console

            //return Task.Run(() => {

            //    //Console.WriteLine(DateTime.Now.ToString());

            //});
            JobKey key = context.JobDetail.Key;

            JobDataMap dataMap = context.JobDetail.JobDataMap;

            string MethodName = dataMap.GetString("MethodName");
            Console.WriteLine(DateTime.Now.ToString() +" "+ MethodName);

            return Task.FromResult(0);

        }

    }
}

Share:

Sunday, December 24, 2017

Tata Sky internal error occurred while processing your request kindly restart the application and try again 0xfd9009 fe1001f4

Tata Sky internal error occurred  while processing your request kindly restart the application and try again 0xfd9009 fe1001f4



Steps to Resolve above error:
1. Install the Tata Sky application 2. Launch the TataSky application >error message displayed 3. Launch Task manager and check PCShowServerPMWrapper and NDSPCShowServer services are running >If it is not running close the application 4. Navigate to C:\Users\XXXX\AppData\Local\TATA\TATA Player 5. Select PCShowServerPMWrapper.exe >right Click on PCShowServerPMWrapper and send to desktop 6. Select NDSPCShowServer.exe service >right Click on NDSPCShowServer and send to desktop 7. Select PCShowServerPMWrapper.exe created on desktop>right click and run as administrator 8. Select NDSPCShowServer.exe created on desktop>right click and run as administrator >Minimize the services window (Don’t close the window) 9. Launch the Tata Sky application



its working.


Share:

Thursday, September 14, 2017

ORA-00001: unique constraint entity framework 6 code first approach

ORA-00001: unique constraint entity framework 6


Solution : - 
The solution is to grant user both: 
'CREATE SEQUENCE' and 
'CREATE TRIGGER' 
permissions and re-create the schema.


Share:

Wednesday, September 13, 2017

ORA-30673: column to be modified is not an identity column oracle 12c

ORA-30673: column to be modified is not an identity column

Answer : - 

Currently orcle 12c does not support modifying an existing column as IDENTITY column 

Solution : - Solution is to add a new column and then drop the existing one

ALTER TABLE Tablename ADD (ColumnName_NEW NUMBER(3) GENERATED ALWAYS AS IDENTITY);
Share: