No Sound on YouTube#

Seems I've had a problem on my PC for quite some time now, in fact its probably since I installed service pack 2 on XP, or it may have been since I installed a new codec pack. 

It seems my default windows sounds went missing mysteriously, although all sounds worked ,as did my SoundBlaster card, AVI and MPEG movies played so it wasn't a codec mapping problem, games went ping, tanks went boom - except it seemed for those on YouTube videos which ticked along silently like a 1920's film clip desperate for the invention of the talkie.  Inspired, I decided to seek a solution!

I did spend quite some time pacing the realms of the internet before I realised that my Volume Icon had also disappeared from the system tray (taskbar) and no matter what I did nothing would reinstate it it.  Consequently, my keyboard volume controls also decided that they weren't going to be in the band either and sat like a bunch of fat kids on a hot school sports day!

So, finally figured out what the hell was wrong with it.  Its seems that something in my configuration when I applied service pack 2 or the codec pack decided to remove my wavemapper entires in the registry.  Consequently, anything trying to use wavemapper sat there and ignored my cry for sound, even though WAV files would play through my SoundBlaster card.

Whats the fix:

My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32

In the right pane, right click and click on New, select String value, enter "wavemapper" (no quotes), press enter, then type "msacm32.drv" and press enter again.

If it doesn't work check you are not missing the actual msacm32.drv file in \Windows\System32' .

If that doesn't work for you get over to Kelly's Corner at URL: http://www.kellys-korner-xp.com/xp.htm where there are some good suggestions for fixing sound in XP.

 

11/30/2006 11:10:14 PM (GMT Standard Time, UTC+00:00) #    Comments  |  Trackback

 

Display XML in the browser#

Had a requirement to throw some XML at the browser and thought this would be a useful snippet to show.

string xmlstr = @"

<statistics>

<gather>66400</gather>

<user_count>666452</user_count>

<user_demand>23.83</user_demand>

</statistics>";

Not much to it really!  The key is to flush and end the response, so no interference comes from the standard asp.net output trying to offer other bits of content type.

XmlDocument doc = new XmlDocument();

doc.LoadXml(xmlstr);

Response.Clear();

Response.ContentType = "text/xml; charset=utf-8";

Response.Write(doc.OuterXml);

Response.Flush();

Response.End();

11/7/2006 1:16:44 PM (GMT Standard Time, UTC+00:00) #    Comments  |  Trackback

 

Extract a Single Node from XML String#

I was asked the other day how to extract a single node value from a string of XML and threw together a quick piece of code to do it.

private void Page_Load(object sender, System.EventArgs e)

{

string xmlstr= @"

<statistics>

<gather>66400</gather>

<user_count>666452</user_count>

<user_demand>23.83</user_demand>

</statistics>";

XmlDocument doc = new XmlDocument();

doc.LoadXml(xmlstr);

XmlNode node = doc.SelectSingleNode("statistics/user_count");

Label1.Text = node.InnerText;

}

The code simply loads the XML string verbatim into an XmlDocument object, which can then simply be  parsed using an XPath selectSingleNode query and slapped into a label control.

If however you have a few entries that are the same in your XML, and you want specific one you can use a use a positional predicate to get the node.

string xmlstr = @"

<statistics>

<gather>66400</gather>

<user_count>666451</user_count>

<user_demand>23.83</user_demand>

<gather>66401</gather>

<user_count>666452</user_count>

<user_demand>23.83</user_demand>

<gather>66402</gather>

<user_count>666453</user_count>

<user_demand>23.83</user_demand>

</statistics>";

XmlDocument doc = new XmlDocument();

doc.LoadXml(xmlstr);

XmlNode node = doc.SelectSingleNode("statistics/user_count[3]");

Label1.Text = node.InnerText;

 

11/1/2006 3:20:53 PM (GMT Standard Time, UTC+00:00) #    Comments  |  Trackback

 

All content © 2008, John Timney
On this page
This site
Calendar
<November 2008>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
Archives
Sitemap
Blogroll OPML
Talk to Me

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail