Posts

Showing posts from 2009

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...

-

Iowa at Michigan State

Image
Iowa played Michigan State last night in East Lansing, Michigan. I am not a sports writer, so I will not attempt it here, but it was one of the best games of football that I have ever watched. A total of three field goals through three quarters of play, two goal line stands from under five yards out, and a last minute drive from behind by the Hawkeyes.


There were records broken on both sides.

All through the game they fought.

-

Norge

Image
I'm not sure why, but I had a sudden rush of Norwegian pride today.

Reaction Time Tester

I wrote this Silverlight app for my Cousin. The trickiest part was raising an event after a random amount of time for the "Wait..." portion of the test. I ended up using a "DispatcherTimer" and set the interval to a Random amount of seconds.




Have Fun!

Monty Hall Test Simulator

Jeff Atwood (Coding Horror, StackOverflow) recently wrote a blog post about the Monty Hall Problem. So I thought I'd write a little app that simulates the tests. I have always thought the contestant has three options, Always Switch (66%), Always Stay (33%), AND Pick Again (50%). People who say your chance is 50/50 after one door is taken out of the equation, are Correct, IF you randomly choose the second door at that time. Check out the app below.

WD = Winning Door.
FC = First Choice.
RD = Removed Door.
SC = Second Choice.



LINQ is not just LINQ to SQL

Deconstructing a LINQ Statement

(download source code: http://aaronhoffman.googlecode.com/files/AaronHoffmanLinqDemov01.zip)


LINQ is a valuable tool, but because of the way it is usually demonstrated, developers think that its only use is for querying a Microsoft SQL Server database. This is because it is usually being demonstrated along with "LINQ to SQL". LINQ is not just LINQ to SQL. I like to think of LINQ as a shorthand (or syntax shortcut) way of writing code - a way to write less lines of code (or simplify code), but still perform the same operations (kind of like what foreach is to the for loop).

I would like to demonstrate LINQ in a way that does not use LINQ to SQL. I will break down a LINQ statement into lines of code that developers might be more familiar with in an attempt to show what is going on under the covers. I will start with code that hopefully everyone has seen/written before, then build up to a LINQ statement that performs the same operation. This way y…