This file contains hidden or 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
#!/bin/bash | |
on_exit() { | |
echo "#The script has quit unexpectidly on line $1" >&$z | |
echo "The script has quit unexpectidly on line $1" >&2 | |
exit | |
} | |
on_error() { | |
echo "Error on line $1" |
This file contains hidden or 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
// Add this to pre-build event | |
// "%CommonProgramFiles(x86)%\microsoft shared\TextTemplating\$(VisualStudioVersion)\TextTransform.exe" -a !!BuildConfiguration!$(Configuration) "$(ProjectDir)Properties\AssemblyInfo.tt" | |
// | |
<#@ template debug="true" hostspecific="true" language="C#" #> | |
<#@ output extension=".cs" #> | |
<#@ import namespace="System.IO" #> | |
<#@ import namespace="System.Text.RegularExpressions" #> | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; |
This file contains hidden or 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
/// <summary> | |
/// Returns all child and grandchild controls of of the specified type. | |
/// </summary> | |
/// <typeparam name="T">Type of control to look for</typeparam> | |
/// <param name="parent">Parent to get list of controls from</param> | |
/// <returns></returns> | |
public static IEnumerable<T> ControlsOfType<T>( this Control parent ) where T : Control | |
{ | |
foreach( Control child in parent.Controls ) | |
{ |
This file contains hidden or 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
/// <summary> | |
/// Turns on or off double buffering for controls that do not expose the property. | |
/// </summary> | |
public static void DoubleBuffered( this Control control, bool value ) | |
{ | |
Type type = control.GetType(); | |
PropertyInfo info = type.GetProperty("DoubleBuffered",BindingFlags.Instance|BindingFlags.NonPublic); | |
info.SetValue(control,value,null); | |
} |
This file contains hidden or 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
/** | |
* \author Drew Chapin <[email protected]> | |
* \copyright Public Domain | |
* \date 2017/12/08 | |
* \details Wrappers for WriteXml() and ReadXml() methods of DataSet and DataTable objects that first compresses the XML using Gzip. | |
* | |
* https://gist.github.com/drewchapin/57b3ae7d5c4ba257aa4e02db88388f9e | |
* | |
*/ | |
using System; |
This file contains hidden or 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
/// <summary> | |
/// Generate a backslash separated path showing parent\child\grandchild relationship. | |
/// </summary> | |
public static string GeneratePath( this Control control ) | |
{ | |
string path = control.Name; | |
for( Control parent = control.Parent; parent != null; parent = parent.Parent) | |
path = String.Format("{0}\\{1}",parent.Name,path); | |
return path; | |
} |
This file contains hidden or 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
static int Update( SqlConnection sql, DataTable table, string tableName = null ) | |
{ | |
int count = 0; | |
tableName = tableName ?? table.TableName; | |
if( String.IsNullOrWhiteSpace(tableName) ) throw new NullReferenceException("tableName cannot be null or empty"); | |
if( sql.State != ConnectionState.Open ) | |
sql.Open(); | |
using( SqlCommand cmd = sql.CreateCommand() ) | |
{ | |
List<string> keys = table.PrimaryKey.Select(x=>x.ColumnName).ToList(); |
This file contains hidden or 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
private void ShiftTextBoxHistory( DataRow next ) | |
{ | |
TextBox[][] c = new TextBox[][] | |
{ | |
new TextBox[]{lastLotNumber1TextBox, lastPartNumber1TextBox, lastBatchNumber1TextBox}, | |
new TextBox[]{lastLotNumber2TextBox, lastPartNumber2TextBox, lastBatchNumber2TextBox}, | |
new TextBox[]{lastLotNumber3TextBox, lastPartNumber3TextBox, lastBatchNumber3TextBox}, | |
new TextBox[]{lastLotNumber4TextBox, lastPartNumber4TextBox, lastBatchNumber4TextBox}, | |
new TextBox[]{lastLotNumber5TextBox, lastPartNumber5TextBox, lastBatchNumber5TextBox}, | |
}; |
This file contains hidden or 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
/** | |
* @author Drew Chapin <[email protected]> | |
* @date 2017/06/27 | |
* @copyright Public Domain | |
*/ | |
using System.Collections.Generic; | |
namespace System.Data |
This file contains hidden or 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
#include <Windows.h> | |
#include <ShObjIdl.h> | |
#include <iostream> | |
int main(int argc, char* argv[]) | |
{ | |
HRESULT hResult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); | |
if( SUCCEEDED(hResult) ) |