Archive for the ‘Uncategorized’ Category

3/6: Quick Wildcard String Compare

UncategorizedShawnNo Comments

Here is a quick function the will allow wildcard comparison.

#include < stdio.h >
 
int striwildcmp( const char *test, const char *value )
{
  int result = 0;
  if( test == value ) {
    return 0;
  }
  if( !test ) {
    return -1;
  }
  if( !value ) {
    return 1;
  }
  while( result == 0 ) {    
    // Skip '?' wildcard
    if( *test != '?' ) {
      result = tolower( *test ) - tolower( *value );
    }
    // Break once you compare a null terminator
    if( (*test == '\0') ||  *value == '\0'  ) {
      break;
    }    
    ++test;
    ++value;
  }
  return result;
}

Read the rest of this entry »

2/3: Auto Update Date Column on Row Change

UncategorizedShawnNo Comments

I was needing a method to automatically update a date field when I adjusted my worksheet row.

Auto Date Worksheet

This is what I ended up with. Change ? to what column you want to track updates on.

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count = 1 And Target.Cells.Column = ? Then
        Target(1, 2) = Date
        Target(1, 2).EntireColumn.AutoFit
    End If
End Sub

4/16: Hex Memory Dump

UncategorizedShawnNo Comments

Here is a nice looking hex dump for those interested.

ADDR | B0 B1 B2 B3 B4 B5 B6 B7  B8 B9 BA BB BC BD BE BF | 0123456789ABCDEF
=====|==================================================|=================
0000 | FF D8 FF E0 00 10 4A 46  49 46 00 01 02 01 00 48 | ......JFIF.....H
0010 | 00 48 00 00 FF ED 0A 96  50 68 6F 74 6F 73 68 6F | .H......Photosho
0020 | 70 20 33 2E 30 00 38 42  49 4D 04 04 07 43 61 70 | p 3.0.8BIM...Cap

Read the rest of this entry »

8/3: Value to Hex String

UncategorizedShawnNo Comments

Ever needed to print out a hex string but needed a converter. Probably not because its build into most string classes. Though if you can’t use a string class then you might just need something like this.
Read the rest of this entry »