Skip to content

Instantly share code, notes, and snippets.

View joymon's full-sized avatar

Joy George Kunjikkuru joymon

View GitHub Profile
@joymon
joymon / dump.aspx
Created April 18, 2019 14:08
ASP.Net test page to dump all the request and environment for debugging
<%@ Page Language="C#" AutoEventWireup="true" Trace="true" TraceMode="SortByCategory" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ASP.NET Diagnostic Page</title>
</head>
<body>
<form id="form1" runat="server">
<%
void DumpIdentityAsTable(object identity)
@joymon
joymon / file1.karel
Created June 6, 2016 18:31
Test coded public gist
A sample karel progrma!
@joymon
joymon / file1.karel
Created June 6, 2016 18:09
Test coded public gist
A sample karel progrma!
@joymon
joymon / IPC_StdIn_Out_Destination
Created July 20, 2015 16:59
IPC using StdIn and Out Destination
class Program
{
static void Main()
{
string[] args = Environment.GetCommandLineArgs();
if (args.Length == 1)
{
//Do nothing
}
else if (string.Equals(args[1],"-process"))
@joymon
joymon / IPC_StdIn_Out_Source
Created July 20, 2015 16:56
IPC using StdIn and Out Soruce
internal class ProcessStarter
{
internal void StartExeToProcessMessage(string pathToExe, CustomQueueMessage customMsg)
{
string serializedMsg = JsonConvert.SerializeObject(customMsg);
using (Process p = GetProcessAfterStarting(pathToExe))
{
p.StandardInput.WriteLine(serializedMsg);
p.OutputDataReceived += (sender, args) => Console.WriteLine("Data receied from child exe - {0}", args.Data);
p.EnableRaisingEvents = true;
@joymon
joymon / SSIS_ScriptTask_Square
Created July 17, 2015 17:38
SSIS_ScriptTask_Square
public void Main()
{
int currentCounterValue = Convert.ToInt32(Dts.Variables["counter"].Value);
int square = currentCounterValue * currentCounterValue;
Dts.Log(string.Format("Inside custom script block value of counter is {0} square is {1}",
currentCounterValue,
square),
0,
new byte[0]);
Dts.TaskResult = (int)ScriptResults.Success;
@joymon
joymon / Invoke_SSIS_With_Parameters_Variables
Last active August 29, 2015 14:25
Invoke SSIS With Parameters & Variables set
internal void TestExecutionInstanceId()
{
Package pkg = GetPackageFromConstantLocationWithParametersSet();
DTSExecResult pkgResults = pkg.Execute();
object executionIdAsObj = pkg.Variables["System::ExecutionInstanceGUID"].Value;
Guid executionId = Guid.Parse(executionIdAsObj.ToString());
Console.WriteLine(pkgResults.ToString());
}
@joymon
joymon / AsyncAwait_WriteFactorialAsyncUsingAwait
Last active August 29, 2015 14:23
Writes the factorial by awaiting on FindFactorial
private async Task WriteFactorialAsyncUsingAwait(int facno)
{
int result = await Task.Run(()=> FindFactorialWithSimulatedDelay(facno));
Console.WriteLine("Factorial of {0} is {1}", facno, result);
}
public void Main()
{
for (int counter = 1; counter < 5; counter++)
{
if (counter % 3 == 0)
@joymon
joymon / AsyncAwait_MainTPL
Created June 24, 2015 16:19
Main method calling the factorial writing using TPL
public void Main()
{
for (int counter = 1; counter < 5; counter++)
{
if (counter % 3 == 0)
{
WriteFactorialAsyncUsingTask(counter);
}
else
{
@joymon
joymon / AsyncAwait_WriteFactorialAsyncUsingTask
Created June 24, 2015 16:17
Writes factorial using TPL
private void WriteFactorialAsyncUsingTask(int no)
{
Task<int> task=Task.Run<int>(() =>
{
int result = FindFactorialWithSimulatedDelay(no);
return result;
});
task.ContinueWith(new Action<Task<int>>((input) =>
{
Console.WriteLine("Factorial of {0} is {1}", no, input.Result);