Skip to content

Instantly share code, notes, and snippets.


Timothy Mugayi monk8800

View GitHub Profile
monk8800 / EmbeddedResources.cs
Created Feb 12, 2015
C# How to get embedded Resources from the currently executing assembly
View EmbeddedResources.cs
/// <summary>
/// Read embeddedResource from the currently executing assembly and log content of files to logger.
/// Files can be anything from resource files to HTML, text files Java-script files etc
/// <remarks>
/// Inside visual studio solution explorer right click any resource -> build action -> select -> embedded resource
/// copy to output directory always
/// </remarks>
/// </summary>
public void TestReadEmbeddedResource()
monk8800 / IDbSetExtension.cs
Created Feb 5, 2015
Entity framework IDbSet Interface expose DbSet.SqlQuery method
View IDbSetExtension.cs
using System;
using System.Collections.Generic;
using System.Data.Entity;
namespace DAL.Models
public static class IDbSetExtensions
/// <summary>
/// When using IDbSet Interface the SQLQuery method is hidden this extension method will allow us to expose the method
monk8800 / JQueryDatatablesDynamicMultiColumnOrderBy.cs
Last active Aug 29, 2015
JQuery Datatables v1.10 C# dyanmic multi column order by method
View JQueryDatatablesDynamicMultiColumnOrderBy.cs
/// <summary>
/// Jquery Datatables dynamic order by
/// supports single or multi ordering of columns
/// parameters extracted from HttpRequestBase.Request
/// </summary>
/// <remarks>
/// logic tested with Jquery datatables v1.10
/// </remarks>
/// <returns></returns>
protected virtual string OrderByMultiColumns()
monk8800 / JQueryDatatablesDynamicOrderBy.cs
Last active Aug 29, 2015
JQuery Datatables v1.10 C# dyanmic order by method
View JQueryDatatablesDynamicOrderBy.cs
/// <summary>
/// Find Jquery Datatables ordering columns from HttpRequestBase.Request
/// </summary>
/// <returns></returns>
/// <remarks>Single ordering</remarks>
protected virtual string OrderBy()
int index =
Convert.ToInt32(Request["order[0][column]"].IsEmpty() ? "0" : Request["order[0][column]"]);
IDictionary<string, string> requestParams =
monk8800 / DownloadExcelPdf.jsp
Last active Dec 15, 2015
JSP Download EXCEL or PDF from Server
View DownloadExcelPdf.jsp
<%@ page import="java.util.*,*"%>
<%@ page import="java.util.Vector"%>
<%@ page import="*"%>
try {
String outputDirectory = "C:\Temp";
String absoluteDiskPath = outputDirectory + File.separator + request.getParameter("file");
File f = new File(absoluteDiskPath);
if (!f.exists()) {
monk8800 /
Created Oct 15, 2012
Quartz 1.6 how to prevent the same job from executing concurrently
package com.blogspot.alotacode.scheduler;
import java.util.List;
import org.apache.log4j.Logger;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.SchedulerException;
import org.springframework.scheduling.quartz.QuartzJobBean;
monk8800 / CommonUtil.vb
Created Oct 14, 2012
Common Util Function Class Using VB.NET String, Integer validation etc
View CommonUtil.vb
Imports System.Text.RegularExpressions
Imports System.Text
Public NotInheritable Class CommonUtils
''' <summary>
''' Determines of a collection contains any objects
''' </summary>
''' <typeparam name="T">generic collection type of type T</typeparam>
''' <param name="data">IEnumerable collection of T</param>
monk8800 / gist:3764750
Created Sep 22, 2012
VB.NET Send email Utility class using SMTP and Handle Exceptions
View gist:3764750
Imports System.Net.Mail
Imports System.Threading
Imports System.Net.Mime
Imports log4net
Imports System.Text
Namespace Utils
''' <summary>
''' This is an Email Utilty class for sending email
monk8800 / gist:3760559
Created Sep 21, 2012
VB.NET Utility Class to Serialize Deserialize Json String
View gist:3760559
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Runtime.Serialization.Json
Imports System.IO
Imports System.Text
Imports System.Text.RegularExpressions
''' <summary>
''' JSON Serialization and Deserialization Assistant ClassS
monk8800 / gist:3760425
Created Sep 21, 2012 singleton
View gist:3760425
Module ExampleSingleton
Sub Main()
Dim myDb As Database = Database.GetIntance
End Sub
End Module
Class Database
You can’t perform that action at this time.