Christmas Rocks

by Kieran

I remember last Christmas people begging me to give them ideas of what to get me.  I actually had no interest in anything other than programming at that stage, and everything I needed was sat on my shelf or on my hard disk, so alas I was given multitudes of vouchers.  This year, however, I made an Amazon wish list and just gave the link out to my family.  Much to my surprise pretty much most of it was bought.  It was my birthday on Christmas eve however, so the list was an amalgamation of both occasions.  I think there’s only a few items left on that wish list.

The most note-worthy of the gifts that were on my list were my POD XT Live and my XBox 360 (yes, I was an XBox virgin before a couple of days ago).  I’ve had a bash on the POD XT Live, and fortunately my amplifier is geared for a setup like this.  There are FX I/O’s so the built-in effects have no effect on the POD.  I’ve yet to buy enough cables to be able to adopt this approach though as three are needed, I have two, and one is borrowed ;).  Some may say the POD XT Live is overkill, but as I may be playing guitar live I was hoping for something mean enough to be able to suit my needs without having to buy extra pedals, and this one looked perfect.  I can’t even remember the cost but my lovely wife surprised me with this, and I didn’t even expect it whatsoever.

I’ll give a rough list of what I can remember getting:

  • XBox 360 60GB (2008) model
  • Messenger kit for XBox 360 controller
  • Wireless headset
  • Far Cry 2
  • PGR3
  • Assassin’s Creed
  • Fable II
  • Bioshock
  • Fallout 3
  • GTA IV
  • Gears of War 2
  • Mirrors Edge
  • Additional XBox Controller
  • Wireless Adapter (to connect XBox to LAN)
  • Wii Fit Board and Game
  • Wii Music
  • POD XT Live
  • Loads of cool Star Wars t-shirts for the ultimate geek
  • Compost Bin :D
  • Loads of books on CSS, X Code 3, Cocoa development, PHP etc.

There was more but I literally can’t remember.  I’m not sure what was with the generous amounts of presents, but I do forget that I have two families now which we split on Christmas day.  We had a really good time, and two Christmas day roasts, we were satisfied with food that’s for sure.  I’ve still yet to have a look at most of my presents.  I’m wanting to start reading all the latest literature but I’m in the UK in February for an intense SQL developer training course, hopefully for MS SQL 2008.

NOTE: We also got my Dad an XBox 360, same model as mine and it died after about 2 hours of use with the red ring of death.  He tested it under my power supply and we had the exact same problem.  Mine’s been fine, however.

A recent to shift from MS SQL 2000 to MS SQL 2008 was required, and assuming everything would go swimmingly, with greater speed increases, and improved development with the integration of Intellisense to the SQL management tools I thought all would be well.  That is until users starting hitting a page which ran a stored procedure.  Upon further investigation it was found that the queries within the stored procedure were causing the server to max out for at least five minutes at a time, hindering from all usage of any web pages.  Odd, seeing as these stored procedures were run on a daily basis on the old server, and a little fore-sight was taken into account for the compile-time of each stored procedure as they were migrated over to the new server.  Unfortunately this wasn’t the case.  Whatever happened in the development of SQL in this eight-year period changed the way queries work.  Consider an example where a join encompasses a nested select, cumbersome sure, but capable, even with a table composed of over half a million entries.  Unfortunately this will take a long, long time.  Once run once the query will run just time again, perhaps because the data is placed higher in the SQL stack.

Moving forwards, this was tested over and over again only to find the same results.  Using CTE’s, views, or temporary tables had no effect on the query either.  Colleagues then attempted alternative approaches to the same query where eventually we reached the use of union.  To our surprise the query worked perfectly, and executed in quite literally 5 seconds, compared to the 5 minutes in previous attempts.

SELECT
Column1,
Column2
FROM
MyTable
WHERE
Column2 LIKE ‘%exp%’ OR
Column1 IN (SELECT Column1 FROM MyOtherTable)

Compared with:

SELECT
Column1,
Column2
FROM
MyTable
WHERE
Column2 LIKE ‘%exp%’
UNION ALL
SELECT
Column1,
Column2
FROM
MyTable
WHERE
Column1 IN (SELECT Column1 FROM MyOtherTable)

The latter example will run much, much faster.  Logically they are the same, and produce the same results, but in fact the difference in performance is substantial.  The only problem is that the better performing query is a much disliked one also.

Well that’s quite a mouthful, but it’s as descriptive and as concise as I can be.  I’ve been using mootools JavaScript library for various things and wanted a slider to slide out information about certain things I’ve been doing on various projects.  The only problem is that there’s no default "closed" or "in" state.  The various solutions I’ve seen are really no good, because when the page loads you will initially see the box that you want to hide, then it will suddenly vanish.  To fix this issue just do the following:

<script language="javascript">
   window.onload = function() {
      var slider = new Fx.Slide('help_slide');
      slider.hide();
   }

   window.addEvent('domready', function() {
      var status = {
         'true': 'Hide Help',
         'false': 'Show Help'
      };

      var helpSlide = new Fx.Slide('help_slide');

      $('help_toggle').addEvent('click', function(e) {
         e.stop();
         helpSlide.toggle();
      });

      helpSlide.hide();

      helpSlide.addEvent('complete', function() {
         $('help_toggle').set('html', status[helpSlide.open]);
      });
   });
</script>

It’s a hack really, but it does the trick perfectly for me.  Other solutions require using some CSS to set the initial set to hidden then changing the style using the JavaScript which has a few bugs.  It’s a shame the library doesn’t support initial states though, perhaps something for future versions.