Tuesday, October 31, 2006

As I have posted myself, and not too long ago either, using the "as" operator in C#, as in SomeType t = obj as SomeType; does not throw an InvalidCastException, but rather returns null if the type conversion did not work.  In my Sorting example, the catch() should be changed to catch null pointer instead.

Tuesday, October 31, 2006 10:12:57 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Friday, October 27, 2006

This is, officially, not supported.  VS2005 is required to debug CF2, and VS2005 does not target CE.net 4.2 devices.  It was a good step forward when the CF2 service pack one came out with runtime support for CF2 and SqlMobile 3 on CE.net 4.2 devices but as someone who loves the debugger, lack of debug suport was a cruel omission.  Often things that are not officially supported will still work in many cases though, so when SP2 came out I tried debugging on my DAP ce4.2 devices.  "A file cannot be created when it already exists", an obscure error with hardly a mention on Google groups or MSDN forums, so I gave up.

Today I was debugging on a CE 5 device from this vendor.  Somehow it got set to "limited user" mode, a proprietery feature of theirs.  Limited user does not have access to read or write most things, including whatever VS2005 needs to start managed debugging on the device.  Lo, I get the same error on my CE5 device which had previously been working for a week "A file cannot be created when it already exists".  Changing back to "supervisor" mode on the device alleviated the issue.  On a whim, I tried the first CE 4.2 device I came across in the office and I get the error. 

Enabling "supervisor", and slowly but surely (much slower than CE5) it deploys to the device.  Starting debugging fails though and I get an error saying it cannot find a version of the CLR compatible with my application, "Some devices do not support automatic CLR upgrade".  Manually upgrading with NETCFv2.wce4.ARMV4.cab, System_SR_ENU.CAB, sqlce30.ppc.wce4.armv4.CAB, sqlce30.dev.ENU.ppc.wce4.armv4.CAB and I'm in business on CE 4.2.  If anyone else has this problem I would encourage experimentation, it might work.

Edit: I should note that my target platform in VS2005 was "Windows CE 5.0 Device".

Friday, October 27, 2006 1:36:04 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback

You gotta love Generics in .Net 2.0.  I had to do some Object-sorting in memory with some List<T> stuff. 

/// <summary>
/// Compare objects of type T using a certain property
/// </summary>
/// <typeparam name="T"></typeparam>
public class PropertyComparison<T> : System.Collections.Generic.IComparer<T>
{
/// <summary>
/// What property of the objects to use to compare one to another
/// </summary>
/// <param name="property"></param>
public PropertyComparison(string property)
{
_propName = property;
}

private string _propName;
private PropertyInfo _prop;

public int Compare(T x, T y)
{
if (null == _prop)
{
_prop = x.GetType().GetProperty(_propName);
}

try
{
IComparable xVal = _prop.GetValue(x, null) as IComparable;
IComparable yVal = _prop.GetValue(y, null) as IComparable;
return xVal.CompareTo(yVal);
}
catch (System.NullReferenceException)
{
throw new ApplicationException("Type " + _prop.PropertyType.ToString() + " is not IComparable");
}

}
}

So then I would use it:

if (!string.IsNullOrEmpty(prop))
{
CarSpot.Mobile.Types.PropertyComparison<Vehicle> c = new CarSpot.Mobile.Types.PropertyComparison<Vehicle>(prop);
try
{
_dataSource.Sort(c);

 

 

Friday, October 27, 2006 12:52:29 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, October 23, 2006

I have 398 movies in my netflix queue right now, I have been told I will never catch up and get the list down below 300.

People are so negative...

Monday, October 23, 2006 9:20:25 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Friday, October 20, 2006

My custom home theater project has been on for a while now.  Yesterday the ole city inspector stopped by and gave me a green sticker on the rough-in of the room.  I live in a code compliant community which means if I ever want to sell this place I actually need to follow the rules as far as permits and Wisconsin Uniform Dwelling Code and such.  Now I just need to finish fishing some wire-conduit and insulate, drywall, paint, enjoy.  It will be a nice room, approx. 21' by 25' with 9' ceilings.  This has been a long time in planning before the house was even started, one of several big plans coming to fruition right now.

Most people could stop reading now, but some may ask what equipment I have:

  • Aragon Stage One 7.1 Preamp/processor
  • Aragon 2005 200 w/ch amplifier
  • Denon DVD-1930ci upscaling DVD/CD/SACD player
  • Main speakers: Klipsch Cornwall II
  • Center channel: Custom built "vertical cornwall"
  • Klipsch THX theater-style dipole surrounds
  • SVS 20-39 PCI active subwoofer
  • 106" diagnol Draper fixed-frame screen
  • Panasonic PT-AX100U projector
  • All cables are Belden copper rated for in-wall use

Later in 2006 or early 2007 I'll buy another 2 channel amp to do 7.1.  On completion, all Wisconsin area nerds will be invited to screen some action films.

 

Friday, October 20, 2006 3:14:25 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback

I cannot talk about a lot of the stuff that is going on at work, and I am suffering from Blog Withdrawl.  I think I am going to merge my technical and non technical blogs here.  Soon readers will be flooded with politics, audio, wedding planning, and more.

Friday, October 20, 2006 2:25:35 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, October 02, 2006
Netflix has challenged the nerds to build a better recommendation technology.  I love the service but I dare say their recommendation system lags behind Amazon.com, at least for my tastes.  This problem seems to scream for some type of AI (genetic algorithms?) solution.  I wish I had time to play with it.

Monday, October 02, 2006 10:55:19 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback