Tuesday, 25 May 2010

Javascript Window Woes!

I'm trying to get windows to resize in Javascript, this sounds simple however it turns out to be a pain in the backside.

I am opening a window using window.open() and then trying to resize it and reposition it using resizeto() and moveto(), this is fine in FireFox but in Internet Explorer I hit issues. Because the page in the child window that I open is hosted on a different domain than the parent page IE hits you with a Permission Denied error.

For now I have got around it by defining the height and width in the window.open() command but this is far from perfect as it does not guarantee the position of the browser on the screen.

Wednesday, 19 May 2010

You can add your country's FIFA World Cup 2010 fixtures to your Google Calendar by:
  1. Clicking Add under Other Calendars on the left hand side
  2. Select Browse Interesting Calendars
  3. Select the Sports tab
  4. Select Soccer
  5. Select FIFA World Cup
  6. Click Subscribe next to you preferred teams
If you want to add all fixtures then Ryan Cullen has done the hard work for you (http://blog.artesea.co.uk/2009/12/world-cup-2010-google-calendar.html) , you can click the + Google Callendar link at the bottom of his callendar to add it to yours.

Sunday, 2 May 2010

Oracle have bought in the much needed PIVOT feature in their 11g database to make our lives much easier, for those of us still living in the past it is still possible to "pivot" your data.

Take the following data for example recording (rare) bird sightings:
Id Bird Sighting
===================
1 Pigeon 01-JUN-10
2 Gull 01-JUN-10
3 Crow 02-JUN-10
4 Gull 02-JUN-10
5 Gull 02-JUN-10
To pivot this data you need to use DECODE. Decode allows to take a value, compare it and if it matches the value replace it with another value (check out PSOUG.org for a better example).
DECODE(input,compare,replace,else)
The following SQL will take the data and give you the bird names across the top and dates down the side:

SELECT Sighting,
SUM(DECODE(Bird,'Pigeon',1,0)) Pigeon,
SUM(DECODE(Bird,'Gull',1,0)) Gull,
SUM(DECODE(Bird,'Crow',1,0)) Crow
FROM Birds
GROUP BY Sighting
And you should get something like this:

Sighting Pigeon Gull Crow
==========================
01-JUN-10 1 1 0
02-JUN-10 0 2 1

This is fine however you need to hard code all the bird names, this is not very easy to maintain in the long run. In this example to way to get over this is to have the SQL query stored as a view, if you have a table containing the bird names you can then use a trigger to rewrite the view every time a bird is added to the table.

To run a create or replace view from within a PL/SQL trigger you can use the EXECUTE IMMEDIATE command.


Saturday, 1 May 2010

Those sneaky people at Microsoft have been trying to hide some of the sound recording functionality in Windows 7.

If you want to record the stereo mix from your sound card you might find that it has been disabled by default, to enable it do the following.

1. Right click on the speaker and click Recording Devices.
2. Right click within this window and select Show Disabled Devices.3. You should then be able to see a Stereo Mix icon, right click on this and select enable.
You should now be able to use your stereo mix as a recording source.