Wednesday 2 December 2009

Switching Audio Devices in Windows 7

/update

I've just released Coastal Audio Changer. This neat little tool will set in your system tray and swap between audio devices with a couple of clicks of the button.


The scripts I've placed below certainly work but they don't work if you hit the corresponding button of your current device. Selecting a different device is fine but if you hit the current device's button the audio control panel won't disappear. That's a little messy and I knew I could do better.

/update over

Those that were use to VistaAudioChanger or STADS in XP to swap between audio devices may have found that like me there was no working version for Windows 7.

Some simple modifications to [Kevin Lo's vbscripts] and [VistaGadgetAudioSwitch] and i've got a working gadget that swaps audio devices.

Instructions
Grab audio switch and drop it's folder into C:\Users\You\AppData\Local\Microsoft\Windows Sidebar\Gadgets

Load up the AudioSwitch.html in notepad and add height:130px; to the css body definition
and the javascript should look like this

var WshShell = new ActiveXObject("WScript.Shell");
function SetAudio(index)
{
switch(index)
{
case 0:
WshShell.Run("Speakers.vbs");
break;
case 1:
WshShell.Run("Headphones.vbs");
break;
default:
break;
}
}

i have two buttons defined, first one is speakers with an onclick value of SetAudio(0), a second headphones button has an onclick value of SetAudio(1)

I would have pasted the complete code but bloody blogger won't allow the html to be displayed - got some reading to do of my own.

Now you have to create the two vbs scripts for headphones and speakers.

My speakers.vbs looks like this (thanks Kevin);
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "%windir%/system32/control.exe /name Microsoft.Sound"
WScript.Sleep(1000)
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
WScript.Sleep(1000)
WshShell.SendKeys "{ESC}"
Set WshShell = Nothing

The above script selects the first option in your sound devices list, sets it as the default sound device and then quits the window. You can test the file is correct by just double clicking on it and checking the results. My headphones is the third device so i have an extra couple of WshShell.SendKeys "{DOWN}" before the {TAB} lines and that's named headphones.vbs.

Drop both files to your windows\system32 folder and you're ready to launch your desktop gadget. That's right click on the desktop and select Gadgets. Drag Audio Switch to the desktop and you should have a working audio switcher.

Wednesday 4 November 2009

brief pause in currency transmissions..

Sorry - went on holiday and had to shut down the little server that does all the currency maps. Now it's back on you should see them appearing any day now. I forget the time gap used in generating the change in exchange rate but i think it's a week.

Friday 9 October 2009

Radio 4 mms url

For winamp, mms://wmlive.bbc.net.uk/wms/bbc_ami/radio4/radio4_bb_live_int_eq1_sl0

Thursday 3 September 2009

Tracking Memory Usage in Windows XP

Another personal reminder.

I've been asked to track the memory usage of a colleague's application. It crashes without a trace after two days. So a series of virtual machines are set up to run the software and I'm using windows xp's perfmon to monitor the memory usage - as that's the suspect here.

In Task Manager we have a column called Mem Usage but if we enter the various counter options in perfmon you'll see no such counter. MS provide a breakdown on what memory counters are available for a process and here's the list;

Process : Page Faults/sec. Excessive page faults from a particular process are an indication usually of bad coding practices. Either the functions and DLLs are not organized correctly, or the data set that the application is using is being called in a less than efficient manner.

Process : Pool Paged Bytes.

Process : Pool NonPaged Bytes.

Process : Working Set. This is the current size of the memory area that the process is utilizing for code, threads, and data. - And this is the equivalent to the Mem Usage column you see in Task Manager.

Now I know next to nothing about memory management so I'm not going to pretend I do but one should remember that applications' working sets are allows to grow if free memory is available in abundance.

Wednesday 19 August 2009

Streaming music sites

Shame i can't use StreamingSoundtracks (workfirewallslol) but have been recommended a few to try;

http://www.citysounds.fm/ is a fantastic hack from music hack day 2009
and http://radiotime.com has a neat option for different streams

and http://listen.grooveshark.com/ also seems to work. nice.

/personal note rather than a blog

Wednesday 15 July 2009

Fix for currency maps

The currency maps are now back. I'll properly test them over the next week. Let me know of any faults.

Thursday 9 July 2009

Winamp + BBC Five Live Sports Extra

Winamp loves mms urls so here's one for the bbc 5 live sports extra channel. Just in time to listen to the Ashes.

mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio5/5spxtra_bb_live_ep1_sl0?BBC-UID=14e87a4b4fd508318a6572473010ec403085feedd060d134242fa9b714a34d55&SSO2-UID=

Wednesday 8 July 2009

A fix to the currency maps...

I've noticed that some of the countries are not appearing.
A bug fix will be in place tomorrow and the data should start working by friday/saturday time.

Monday 18 May 2009

More exchange rate kml files

Shortly after i post this my little server should be spitting out some currency maps for the other major world currencies. Data is still shown as the rate of change over the last 48 hours.

Australian Dollar (AUD)
British Pound (GBP)
Canadian Dollar (CAD)
Euro (EUR)
Hong Kong Dollar (HKD)
Japanese Yen (JPY)
Swiss Franc (CHF)
US Dollar (USD)

From the 4th June i'll switch the currency maps to reflect a 30 day change which should be pretty useful for planning holidays. If you find this data useful or would like something specific drop me a line and i'll see what i can do.

Tuesday 5 May 2009

Dollar exchange rate map for Google Earth

I'm pleased to publish my dollar exchange map for Google Earth. Each country is colour coded to how it's performed against the dollar over the last 48 hours. So if the country is red in colour then it's currency has dropped against the dollar and if green then they're doing alright.

Click here for the KML file.

I'll be switching to a 30 day view rather than a 48 hour period once enough data has been sufficiently captured. I'm accepting requests for private services if anyone would like access to the data in a different format than provided.

The data comes from some of the regualr exchange rate sites and it was a case of a using a mixture to identify all the currencies used in the world. Before now i had no idea you could use the Euro in South America and off the coast of Canada. It's been bit of a lesson in geography 101 tbh.

Anyway hope you enjoy.

Wednesday 8 April 2009

daily reasons why one should dislike ESRI

Here's an extract from the ArcObjects's Dynamic Layers section of their manual;

  1. BeforeDynamicDraw(esriDMDPLayers) event is being fired
  2. Layers are drawn; these are the layers that do not support IDynamicLayers (static layers)
  3. AfterDynamicDraw(esriDMDPLayers) event is being fired
  4. BeforeDynamicDraw(esriDMDPDynamicLayers) event is being fired
  5. Dynamic layers are drawn
  6. Immediate phase (esriDDPImmediate)
  7. Compiled phase (esriDDPCompiled)
  8. AfterDynamicDraw(esriDMDPDynamicLayers) event is being fired
'is being fired' just grates right up my spine. Horrible, horrible english. On aside, i have no idea why BeforeDynamicDraw and AfterDynamicDraw takes non-dynamic layers as a parameter. Clue's in the name buddy.

Tuesday 24 February 2009

Step back in time

Sometimes when expensive software expires it's annual licence and the new licence key is lost in the post.. sometimes, just sometimes the old hack of turning back your system clock does the trick of fooling the licenced software. Unfortunately if you're on a domain time date updates are handled not by the user. Sure you can change the time but after a while the pc will correct the error. So what you need is a batch file that will change the date & time and schedule task that to run every ten minutes or so.

Contents of batch file
Echo Time_Format | Time
Echo Date_Format | Date

eg; Echo 00:00:00 | Time
Echo 01/01/70 | Date

Saturday 21 February 2009

Coastal's Movie Cleaner now does Fan Art

My little movie cleaner now supports fan art. I still prefer it's use over other movie info tools out there. Movie Info Plus seems to load all the fanart into memory before asking you to select one. I'm not sure of the reasoning for that but mine uses the same source [thanks theMovieDB.org] but you just download the one you want. I'll have to tidy up the .nfo file bit now as that's looking like a proper cheap trick.

Anyway, to get my little movie cleaner click here

Friday 6 February 2009

Augemented Reality

http://www.enkin.net/ have made a very nice app. for the android platform. Tagging 3D objects such as buildings it exploits gps, geotags and object detection.

MySQL Backup command

A complete reference to myself and no other;

How to dump all databases from MySQL command line;
mysqldump -u root -pPassword -x --all- databases > db_dump.sql

Thursday 22 January 2009

Winamp and BBC radio

Due to network restrictions at work i'm forced to use Windows Media Player to listen to BBC radio. I've noticed that you can drag and drop the 'play this station' link to the desktop and then load this up in Winamp. It works fine and you can save it as a bookmark.

Here's an example mms://wmlive-acl.bbc.co.uk/wms/radio5/5Live_e1s1?BBC-UID=14e87a4b4fd508318a6572473010ec403085feedd060d134242fa9b714a34d55&SSO2-UID=845545f13b58b6323a1fa459d15254ab4ae0d22f2883c169648a2d11d287610d10

Thursday 1 January 2009

MySQL connection checks

After months of not being methodical i finally sorted out my connection problems with win64 client to win32 mysql server. A great post by Michael Kay sums up the checks to run through though i didn't particular understand the netstat check. I'll have to read up on that.

To quote Michael;
10060 is the error number not the port so no need to open that up on the firewall.
3306 is the standard port for connecting to mysql.
Check that skip_networking isn't on by running SQL Query
SHOW VARIABLES LIKE "SKIP%"
locally to the machine... If it is ON then turn it OFF. This can only be done in the config file and just means commenting out the skip_networking line. Also check that the port for networking is 3306 while your there.
Also check that mysql.sock is listening on 3306 using netstat from a console on the machine locally.
Check your firewall allows port 3306 to connect to your machine. This will depend on the firewall your using.