Cybercrux

Everything is achievable through technology


Leave a comment

Rules Explained

1st RULE: You do not talk about FIGHT CLUB.

2nd RULE: You DO NOT talk about FIGHT CLUB.

3rd RULE: If someone says “stop” or goes limp, taps out the fight is over.

4th RULE: Only two guys to a fight.

5th RULE: One fight at a time.

6th RULE: No shirts, no shoes.

7th RULE: Fights will go on as long as they have to.

8th RULE: If this is your first night at FIGHT CLUB, you HAVE to fight.

Advertisements


Leave a comment

Find all subsets of an int array whose sums equal a given target

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

namespace BusinessRule
{
static class Program
{
static int TargetSum = 2;
static int[] InputData = new[] { 1, 2, 4, 8, 16, 32, 64};

static void Main()
{
GetCombinations(InputData, TargetSum).ToList().ForEach(x => Console.WriteLine(x));

Console.ReadKey();
}
public static IEnumerable<string> GetCombinations(int[] set, int sum, string values=””)
{
for (int i = 0; i < set.Length; i++)
{
int left = sum – set[i];
string vals = set[i] + “,” + values;
if (left == 0)
{
yield return vals;
}
else
{
int[] possible = set.Take(i).Where(n => n <= sum).ToArray();
if (possible.Length > 0)
{
foreach (string s in GetCombinations(possible, left, vals))
{
yield return s;
}
}
}
}
}

}
}


Leave a comment

Converting columns into rows in SQL Server – UNPIVOT and other

Learn about different implementations of T-SQL UNPIVOT transformations. What are the best ways for converting columns into rows?

Source: Converting columns into rows in SQL Server – UNPIVOT and other


Leave a comment

Simple Async Await Example for Asynchronous Programming

Stephen Haunts { Coding in the Trenches }

In this article I want to give a simple example for how to use the async await keywords in C# to create asynchronous background tasks.

Writing multi-threaded or asynchronous code has traditionally always been very hard to get right but is something that is needed to help keep our applications responsive and to avoid performance bottlenecks. C# 5 introduced a simplified model for doing asynchronous programming with the introduction of 2 new keywords, async and await.

If you specify that a method is an asynchronous method by using an async modifier, you enable the following two capabilities.

  • The marked async method can use the await keyword to designate suspension points. The await operator tells the compiler that the async method can’t continue past that point until the awaited asynchronous process is complete. In the meantime, control returns to the caller of the async method. The suspension of an async method…

View original post 652 more words


Leave a comment

Scrum Daily stand-up template

What did you do yesterday?
What will you do today?
Are there any impediments in your way?

Yesterday i was working on
yesterday i did
yesterday i got

today i plan to

my impediments/blockings/obstacles are

My ____ broke and I need a new one today.
I still haven’t got the software I ordered a month ago.
I need help debugging a problem with ______.
I’m struggling to learn ______ and would like to pair with someone on it.
I can’t get the vendor’s tech support group to call me back.
Our new contractor can’t start because no one is here to sign her contract.
I can’t get the ____ group to give me any time and I need to meet with them.
The department VP has asked me to work on something else “for a day or two.”


Leave a comment

What really is Katana and owin?

resourceful post

Code! Code! Code!

What really is really Katana? How about Owin? After playing around with Katana, I really found it worthywhile to post about what I have found regarding them. OWIN ( initials for Open Web Interface for .NET )is a set of specifications that defines a stardand interface between which .NET web servers and web applications communicates. Katana on the hand is an implementation of the OWIN.

A little history of ASP NET is that it was released in early 2002 or sometime around then, with .NET framework 1.0 and it was meant to bring a web experience for customers who included classic asp  and desktop line of business application developers like VB 6.

There were alot of stuff and concerns brought forward by these two customers, which meant that the framework was to be monolithic leading to inclusion of all concerns in one single package, System.Web.  The package included just to…

View original post 966 more words