This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
combine(new int[] { 1, 2, 3, 4, 5, 6 }, new List<int>(), 0); | |
static void combine(int[] a, List<int> outstr, int index) | |
{ | |
for (int i = index; i < a.Length; i++) | |
{ | |
int count = 0; | |
foreach (var item in outstr) | |
count += item; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConcurrentGateway | |
{ | |
private ConcurrentQueue<Action> _workQueue = new ConcurrentQueue<Action>(); | |
private int _writeLock = 0; | |
[ThreadStatic] | |
private static AutoResetEvent _waitEvent = new AutoResetEvent(false); | |
protected static AutoResetEvent GetThreadWaitEvent() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AsyncTask : IDisposable | |
{ | |
private readonly bool _envDTETask; | |
private readonly object _objlock = new object(); | |
private readonly TaskFunction _taskFunction; | |
private readonly Thread _thread; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.geeksforgeeks.org/wildcard-character-matching/ | |
//https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.wildcardpattern.containswildcardcharacters?view=powershellsdk-7.0.0 | |
public class Wildcard | |
{ | |
private readonly string _pattern; | |
public Wildcard(string pattern) | |
{ | |
_pattern = pattern; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool ANSI(string filename) | |
{ | |
var file_stream = File.OpenRead(filename); | |
if (file_stream == null) return false; | |
var stream = new BinaryReader(file_stream); | |
var file_size = file_stream.Length; | |
byte[] buffer = new byte[file_size]; | |
stream.Read(buffer, 0, (int)file_size); | |
stream.Close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class PdfDocument | |
{ | |
public static void AddRange(this Document document, IEnumerable<IElement> elements) | |
{ | |
elements.ForEach(f => document.Add(f)); | |
} | |
public static byte[] Concat(IEnumerable<byte[]> documents) | |
{ | |
Guard.NotNullOrZeroLength(documents, nameof(documents)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.Composition; | |
using System.IO; | |
using System.Linq; | |
using com.centralaz.RoomManagement.Attribute; | |
using com.centralaz.RoomManagement.Model; | |
using com.centralaz.RoomManagement.ReportTemplates; | |
using iTextSharp.text; | |
using iTextSharp.text.pdf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this script is for SQL Server and Azure SQL | |
--https://raw.githubusercontent.com/quartznet/quartznet/master/database/tables/tables_sqlServer.sql | |
USE [enter_db_name_here]; | |
GO | |
IF OBJECT_ID(N'[dbo].[FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS]', N'F') IS NOT NULL | |
ALTER TABLE [dbo].[QRTZ_TRIGGERS] DROP CONSTRAINT [FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS]; | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class CollectionServiceExtension | |
{ | |
public static IServiceCollection Registers<TService>(this IServiceCollection services, ServiceLifetime lifetime, params Assembly[] assemblies) | |
where TService : class | |
{ | |
return services.Registers(lifetime, assemblies, typeof(TService)); | |
} | |
public static IServiceCollection Registers(this IServiceCollection services, ServiceLifetime lifetime, Assembly assemblies, params Type[] interfaceTypes) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Logging; | |
namespace DomainServices | |
{ | |
public class DataBuilder<TIn, TOut> where TIn : class where TOut : class, new() | |
{ |