by adam
19. May 2010 10:45
Well I caved in and finally signed up for Twitter. My Twitter page can be accessed at: http://twitter.com/aplocher
by adam
23. October 2009 15:44
The following snippet of code can be used to determine whether a Windows Mobile ComboBox is currently dropped down or not:
using Microsoft.WindowsCE.Forms;
...
private const int CB_GETDROPPEDSTATE = 0x0157;
private bool IsComboBoxDroppedDown(ComboBox comboBox)
{
Message comboBoxMessage = Message.Create(comboBox.Handle, CB_GETDROPPEDSTATE,
IntPtr.Zero, IntPtr.Zero);
MessageWindow.SendMessage(ref comboBoxMessage);
return (comboBoxMessage.Result != IntPtr.Zero);
}

by adam
19. October 2009 10:43
Microsoft has made Visual Studio 2010 and .NET 4 beta 2 available today to MSDN subscribers with general availability on Wednesday (10/21).
Download the beta from: http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx
There are several new features available which you can read about at the following links:
Scott Guthrie has written several great posts detailing new features in Visual Studio 2010:
http://weblogs.asp.net/scottgu/archive/2009/08/25/vs-2010-and-net-4-series.aspx
What's new in ASP.NET 4.0 (Microsoft Whitepaper):
http://www.asp.net/learn/whitepapers/aspnet40/
Learning Resources for C# 4.0 and .NET 4.0:
http://bogdanbrinzarea.wordpress.com/2009/04/24/learning-net-40-new-features/

by adam
7. October 2009 11:11
I was recently tasked with generating a string of averages based on a list of business objects. The business object has a string property called VehicleName and a decimal property called StandardMpg. The averages needed to be calculated per VehicleName, so this is to be what I group on. This took me a few minutes to wrap my mind around, but once I got it, it seemed fairly simple. I thought it would be worth sharing with the rest of you:
string averages = string.Format("Avg: {0}",
string.Join(" | ", gasMileageList
.GroupBy(x => x.VehicleName)
.Select(c => string.Format("{0} {1} MPG", c.Key, Math.Round(c.Average(x => x.StandardMpg), 1))).ToArray()));
The output will look something like: "Avg: bmw 21 MPG | kia 30 MPG"
Another option would be to dump the averages out to a list of objects, instead of a string. To do this you can do:
private class MileageAverage
{
public string VehicleName { get; set; }
public decimal Average { get; set; }
}
...
var averages = gasMileageList
.GroupBy(x => x.VehicleName)
.Select(c => new MileageAverage { VehicleName = c.Key, Average = c.Average(x => x.StandardMpg) });

by adam
1. October 2009 23:28
Well I did it! I got married on September 12 to my beautiful wife, Alejandra, in South Lake Tahoe. I couldn't ask for a better girl (hell, she's a .NET developer, too!).

af094e43-03aa-4477-a67a-fe9d7c44e712|0|.0
Tags:
My Life
by adam
18. May 2009 19:43
You may have noticed that Digital Propulsion has been out of commission for a few months. It was partly due to changing host providers, but mostly due to my laziness. It's now back and powered by BlogEngine.NET 1.5 which is pretty sweet. In the near future I will repost some of my older articles along with some new stuff.