Posts

Microsoft Excel Find Next Value Change in Column Macro

Image
I find that if I’m working with data from a SQL query it is easier to manipulate, sort, and filter that data in Excel than it is in the SQL query itself.  I am also a fan of using Excel as a Data Visualization/Reporting tool.  Because of these two things I tend to work in Excel quite a bit and have developed a few macros to help make my life easier.

Many times when you are working with data from a SQL query and you sort on a “dimension” column (example below) you will have many repeated values in a single column.  If you want to page through the data and find when the values changes from one to the next, Excel does not have the built in ability to do this.  However the Macro to perform this function is pretty easy to write.

In the image below the data was sorted on the “Type” column.  If cell B3 is selected and the FindNextValueChangeInColumn macro is run, cell B7 would be selected.  If it is run a second time cell B12 would be selected and so on.


Here are the Macros to copy and paste…

Visual Studio Code Snippet for a Notify Property (INotifyPropertyChanged)

Image
updated version can be found here: https://aaron-hoffman.blogspot.com/2017/12/vs2017-visual-studio-2017-code-snippet-wpf-inotifypropertychanged.html

In the ViewModel classes of projects following the M-V-VM pattern it is often necessary to raise a "PropertyChanged" event (to assist with INotifyPropertyChanged interface implementation) from within a property's setter.  This is a tedious task that will hopefully someday be solved by using the Compiler as a Service...  But until that day comes, I've created a handy Visual Studio Code Snippet for myself to help automate this task.  The XML for the code snippet, and an example of the code it produces are below (note the Base Class and the OnPropertyChanged() method call).  Continue reading to see how to "install" and implement this snippet.


--------

<?xmlversion= "1.0 "encoding= "utf-8 " ?><CodeSnippetsxmlns= "http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet "> …

Silverlight Color Picker ComboBox (DropDownList)

During a Silverlight project I finished up a while ago I needed to create a "simple" Color Picker ComboBox (or DropDownList for us ASP.NET Developers).  By "simple" I mean limited to only a handful of colors, not as complex as something like Paint.NET (read PhotoShop) would provide.  This is the easiest solution that I found.

The first thing you need to know is that the ComboBox has an ItemTemplate.  This template allows you to completely control the look and feel of each entry in the ComboBox.  From simple things like binding to a property to change the background color (hint hint, that is what we are about to do), to more complex things like changing the entire template based on the type of class being bound to this item in the ComboBox (ex: the ComboBox is bound to a list of "fruits" some are apples and some are bananas.  The apples all use one template, the bananas use a completely different template - powerful).

We'll be binding this ComboBox to …

Simple Keystroke Automation in .NET (Scott Hanselman's Http Button)

Image
--
Scott Hanselman (http://www.hanselman.com/http://twitter.com/shanselman) recently tweet'd, "I need a keyboard with an "http://www." button."

To which I replied, "@shanselman you still type the "http" part? I didn't think you had to anymore..."  Oooh, hahahaha, how smart and funny am I!?  ....Apparently not very... :-)

shanselman responded (as well as to others with the same smart remarks), "@aaron_hoffman in tweetdeck or Twitter, you do."  --Aaaah, I get it now, he's not in a browser! okay, he has me in Check.

Now I just had to solve this problem.  Well automation/degree in laziness (with years of laziness experience) to the rescue!  At first I thought PowerShell - but since I am on a WinXP SP2 machine, that wouldn't do.  I'll have to fall back to the console app & desktop shortcut combination of yester-system.

Steps to Simple Keystroke Automation (w/ WinXP SP2 Handicap)

1. Create .NET Console App
2. Write/B…

Unique Characters

Ever notice how similar a lot of the "English" alphabet's characters look? The guy who put this together must have really phoned it in that day.

He really could only come up with these:
ABCDEFGHIJK_MNOPQRSTUV_XY_
and then just flipped a few around a bit to get up to 26:

J L
M W
S Z

And it isn't just those three, a lot of the original list look eerily similar to each other as well, but I guess we'll count them:

B R
E F
H K
M N
O Q
U V
T Y
Y X

but then he needed to come up with 10 more numbers... well none of those are unique!


0 O
1 I
2 Z
3 E
4 P
5 S
6 G
7 L
8 B
9 P

So in the end, if you are looking for unique characters that you can use, that will not be confused with any other characters, you're only left with:

A

well that isn't very many...

-