Saturday, July 11, 2009

p5gc-mx + unable to install realteak audio driver

I just formatted my harddisk today but was unable to install the realtek Audio driver.

Solution:

Recently had a PC with XPSP3 and an Asus P5GC-MX/1333 in in my hands. Problem: No audio at all, the Realtek High Definition Audio Drivers did not want to install. At the end of the install an error message pops up (Realtek High Definition Audio driver install has failed) and then the installer closes. Urgh! :(

After some fiddling in Device Manager (remove the darn thing and such) accompanied with some reboots I hit Google and read something about the KB888111 hotfix from Microsoft. After finding it, it couldn’t install as this one already’s included in SP3. No.luck :(

Eventually I tried with the the latest drivers from Realtek. The error was still there, but a more specific one came out: HD Audio Bus Driver Failed to load: 0xE0000227. Aha, a clue!

A few Googleminutes later I found the solution:

  • Go to Device Manager/Device Drivers
  • Under System Devices find Microsoft UAA HD bus driver
  • Now, first disable it …
  • … and then uninstall it.
  • Close the Device Manager and run the Realtek setup
  • Tadaa, it works!

Tuesday, July 7, 2009

What’s the difference between ‘int?’ and ‘int’ in C#?

int? is the same thing as Nullable. It allows you to have "null" values in your int.
eg.
public bool AddProduct(string productName, int? supplierID, int? categoryID, string quantityPerUnit, decimal? unitPrice, short? unitsInStock, short? unitsOnOrder, short? reorderLevel, bool discontinued)

Explained :
int?, is the shortcut way of saying Nullable.
Value types, such as Int32, cannot hold the value null. This is a problem when dealing with databases, which can distinguish "no value" (e.g. DBNULL) from 0 and the ordinary range of values. The Nullable type helps overcome the divide between the world of .NET and the database world, as Nullable (or int?, if you prefer) can hold the value null (you can check the variable's HasValue property to see if it contains a value or not). Nullable also has a value property so that you can read the value (or you can simple cast the variable to the appropriate type.
So, to summarise.
int is a .NET value type holding a signed 32-bit integer. It has no HasValue or Value properties because it just is the value.int? is a shortcut for writing Nullable. To see if it currently holds a value you use the HasValue property. To read the value you either use a cast or read the Value property.

Convert ArrayList to Generic List with using foreach

Using Foreach
ArrayList arrayList = GetArrayListOfInts();
List intList = new List();

//Can this be foreach be condensed into one line?
foreach (int number in arrayList)
{
intList.Add(number);
}
return intList;

Without Using Foreach
var list = arrayList.Cast().ToList();

Without Using Foreach for .Net 2.0
List newList = new List(arrayList.ToArray(typeof(int)));

Thursday, July 2, 2009

Log Parser

SELECT * FROM 'C:\Backup\*.*' WHERE Text LIKE '%hello%' AND Text LIKE '%world%'