Cross-Platform Team Development Setup

Fortunately for me I started out software development in the times where Java-based IDE’s were available meaning I’d use the same one in Linux and Windows. Now that I primarily develop in Mac OS X I need to make sure that I can work alongside team mates whom work under Linux or Windows. Fortunately we can all have the same Subversion client, the same IDE, and generally the same plug-ins whilst working on the same project but under different environments.

The very first thing you’ll want to do is get the subversion binaries and install them in the dmg format provided if you’re on Mac. It took minutes to get this part setup and is generally very straightforward.

As we’re working on a PHP project we first headed over to the Eclipse PDT page and got the all-in-one package as this means we don’t have to do any setting up of any kind. I’ve found getting a base install of Eclipse and then figuring out how to add the PDT plug-in later on generally causes more problems for me. The only downside to getting the all-in-one package is that it won’t be the latest build of Eclipse, if you’re okay with that.

The second step was to install the Subclipse plugin. To do this you simply open Eclipse, hit “Help” then “Software Updates”, click on the “Available Software” tab, then click on “Add Site” and enter http://subclipse.tigris.org/update_1.6.x into the input box (make sure you always use the latest version however). Once you click okay Eclipse should install Subclipse in the background. You must ensure you have an installation of the subversion binary for this to work, otherwise you can get some random errors that confuse you.

Once this was set up myself and my team mate went on to unfuddle, an extremely good project management and subversion base and set up our repository and project. We then right-clicked on our repository pane in Eclipse and hit the “Create Repository” button and entered the relative details. From here, as long as you understand subversion basics, I’m sure you’ll get along with it just fine. The very first thing we tend to do is to create folders “branches”, “tags”, and “trunk” which is just a standard set up. Following this, as it’s a web project, we create the folders “admin”, “include” and “content” within the trunk folder.

Posted in Pages | 1 Comment

Facebook Just Turned Into Twitter

The mad phenomenon that is Twitter has been a serious influence on the latest version of Facebook, so it seems. I think the very first thing I said when I logged onto Facebook today was “Facebook is trying to be like twitter”, low and behold many other of my friends were sporadically “status changing” with the exact same thing. Well that’s just a darn shame. I think the Internet has gone into an adverse state of pointlessness.

Posted in Pages | Tagged , | 1 Comment

IHttpModule Over Global.asax

I had the job of re-writing some old code that existed in Global.asax which is used to respond to certain initialisation and tear-down events. A significant event of ours is the Session_Start event as this is where we assign session variables used for the lifetime of the transactions carried out by the user. It’s quite common practise as I have seen and is extremely handy in the context of our application.

The re-write was basically to move some code to a more secure location within a compiled stored procedure on our SQL server (later versions of SQL provide some handy features). I first researched any improvements upon Global.asax as it has been around for so long and had been superseded by its predecessor, Global.asa. IHttpModule was a major hit and seemed to be specifically designed for the purposes of improving upon Global.asax. VB.NET isn’t quite as savvy as registering event listeners in comparison to other popular languages such as C#.NET or Java so that was the first major hurdle I had to get over (which took quite some time, MSDN isn’t the best search tool ;) ). Unfortunately upon further coding I came to realise that the Session_Start event which was freely available – and worked perfectly in Global.asax – firstly didn’t even exist, and secondly required some hacks to ensure that the relative code was called at that specific point in the initialisation of the web session. The solutions I saw just weren’t worth it to be honest.

If you’re looking to ensure that certain code is called on Session_Start then I’d highly advise just sticking with Global.asax. If you don’t require Session_Start and Session_End then it’s definitely worth looking at implementing the IHttpModule interface. Registering the class in your Web.Config allows it to respond to the relative events that are setup to respond to within the implementation. It’s basically a modularised solution to Global.asax. Anyway, I thought this may be a handy bit of knowledge to save you a few hours of tedious work :)

Posted in Pages | Leave a comment

Hectic Fortnight

A couple of weeks ago I headed off to the UK for a number of reasons, here’s the low-down of what went on.

Training

My company sent me on a SQL developer training course, although it didn’t go as well as I was expecting it to. In fact, on the first day of the course I quite bluntly confirmed that I would be failing it. The course outline in no way reflected the actual content of the course and has since – I believe – been revised. We were under the impression that I would be learning more-so about real development using MS SQL Server but alas it covered things I had never even heard of and more worrying was the fact that I hadn’t done the pre-requisite so when it came to one of the day’s where we’d talking about subject y, you’d have to have first learnt about subject x in the pre-req course leaving me quite abandoned for a whole day. 90% of the time I was there I think I was in another world just trying to understand what was being spoken about let alone learning about the subject matter. I kept up with the reading but was swamped with chapters on subjects I’d never even heard of when in relation to SQL server. Questions such as “Would you use the Service Broker to do this?” were quickly responded to with another question such as “What is the Service Broker?” – I was then told that it couldn’t be taught in this course and was something that we should know already.

Sufficed to say my work mates were extremely supportive amongst my incoherent stressful ranting and instead I managed to approach the content with a more constructive approach by taking as much out of it as I can (which I believe I did). Ultimately I failed both of the exams, but there was only a 30% pass rate out of our class so I didn’t feel so bad after I had learnt that others on the course who had ten times the amount of experience and knowledge in SQL server and had actually done the pre-req and failed this course. I feel terrible for saying so, and I’d never want to feel happy out of someone’s failure, but I felt more comforted to know that even those whom had experience and knowledge in the correct areas found it quite difficult. I’m sure they won’t have a problem passing the course when they re-take the exams.

Unfortunately the company we dealt with have a few lines of service, the first being customer support, those whom only have to know what the course consists of and work on a “we pay you by customer” basis just allowed me to go on the course fully well knowing I didn’t have enough knowledge or experience which is a big let down for the company and now we know that our internal discussions about the course should not be persuaded by training company employee opinions.

I actually didn’t fail by much, the course works on a pass/fail basis where you have to get 70% or over, I think I got something like 59% which isn’t bad considering that I knew absolutely nothing about any of the course content and it was a six day course. Due to an NDA I signed I’m unable to speak about much of the course content or anything about the exam whatsoever.

London

My wife joined me a few days after I finished the course where we stayed in Oxford – she hadn’t been to London before so we decided to do a few tourist things such as London Dungeon and The Tower of London which were okay. My wife knows a scary amount about history so she gave me all of the realistic details. We got to check out the crown jewels which were probably the most impressive part of The Tower. It was absolutely packed considering it was a gloomy February day.

The London Dungeon was an absolute nightmare considering the local schools decided to send in all of their children in a few buses worth. The queue lasted about 30 minutes before a friendly staff member noticed that real tourists had come and were receiving some incredibly bad service and decided to bump us up the queue and push us to the front. The Dungeon was more of a visual thing rather than a factual thing, and there’s an incredibly crap water ride inside. Fortunately we got in on the two-for-one offer that’s all over London.

We went to Oxford Street shortly after just so I could show my wife the real central London. We went in a few shops but we’ve not got much money after all of this so decided not to go shopping.

Hospital

The real purpose of the second week of my trip to the UK was to go into hospital for a prolonged EEG which lasts a few days. Basically they hook you up to a machine where twenty-two probes are super glued to your scalp and a heart monitor is attached then you’re sent off on your way to monitor brain activity and heart rate. It was quite uncomfortable and I felt like quite the idiot walking around even with my hoody up. We went out on the Thursday night for dinner with some friends in Oxford where we were staying. We had an amazing night just catching up really and I ended up taking my hood off as it got so hot. I think the entire restaurant just stared at me the entire time trying to figure out what was going on. My friend whom I won’t name thought it’d be funny to tell the staff “he’s terminal” so they’d stop staring (and try and get a free meal) – whilst hilarious as it was I quickly stopped him ;)

We got a chance to actually watch my brain waves live which was quite weird. It looked much like any regular line graph with four different sections which all looked like a flat-line heart monitor. When the graph suddenly changed and all the monitors dipped rapidly I got quite worried until the neuro guy said to me “that’s what happens when you blink”. Your brain waves go through a radical change when you blink, otherwise they look quite regular so it was really interesting to see this live.

Safely Returned

Sufficed to say, I couldn’t wait to get back. Going to the UK wasn’t the best time for me as I’ve been just so busy and loads of things have been going on. I’m actually looking forward to going back to work which isn’t that surprising as I really enjoy my job and feel I’m a bit more equipped for dealing with our large-scale databases which grow an extraordinary amount each day. I’ve realised that the difference between SQL 2000 and SQL 2008 are so big that if you were a professional SQL 2000 developer it’s absolutely vital that you train for SQL 2005+ because Microsoft have actually pulled their finger out and done a really good job by providing some exceptional tools. Although I’d just like to point out here is that the only real Microsoft software I like are their developer tools (i.e. VS and SSMS).

Also, tomorrow my brother is leaving the island for at least a few years so we went out for dinner with him tonight as a send off. In the last couple of years he’s had pneumonia, cancer and loads of other illnesses so I’m hoping that in places like India and China where he’s headed don’t destroy his immune system more than it already has been but I think it’ll be really good for him.

Posted in Pages | Leave a comment

To The UK!

I’m off to the UK today for two reasons – the first is my SQL “programming” course that lasts 6 days, and is meant to be more intense than university for such a short period of time. It’s rumoured to be 14 hour days with enough time inbetween days to eat and shower. I’m not expecting to pass the exams as I’m inexperienced, but that’s the point in me taking the course in the first place. The courses are designed to be for advanced developers, and my weakest point is actually my SQL development. Most people see it as quite an easy language – which it is – but there’s a much more advanced side to SQL that we deal with at our work, especially when you end up with ten temporary tables serving data up through twenty joins to bring back financial data that could cause some serious upset if the query were wrong. Seeing my developer peers working on those queries shows me a) how little I know about our data and b) how little I know about advanced SQL queries.

The second reason for me going to the UK this time around is for my hopeful last hospital visit at the specialist neurology centre. The truth is that my neurologist still believes I’m having either mini-seizures or unrecognisable fits (they come in many different forms) hence why I’m still not allowed to drive after over two years of waiting. The test I’m having is an EEG, so they strap me up to a machine for a few days and let me look like a cyborg from the future sent back in time to visit tourist attractions around England. My wife is joining me for that week, so at least I won’t have to spend it on my lonesome.

Anyway, this means I won’t be responding to e-mails for the next two weeks as I’m not taking my laptop with me.

Posted in Pages | Leave a comment

Rotating a Cuff?

I’ve just got home after being in hospital since roughly 7am this morning. I’ve been having shoulder problems for the last week which have been getting progressively worse despite my heavy dosage of pain killers. Well, I woke up at about 6am this morning screaming in pain as I couldn’t move my arm at all, and any slight movement caused such horrible pain that I didn’t quite know whether to scream, cry or just pass out. The X-Ray showed nothing and the doctor seems to think it was caused by a torn rotator cuff. I can’t use my left arm at all, and being left handed really doesn’t help. Worst of all I’m due to go on training in the UK this Sunday, and without the use of my left arm I won’t be able to travel as I’m getting almost four hours worth of train ride to my destination including a few changes through the London Underground.

I’m due to get an ultra-sound this week before I leave to determine where exactly the problem lay and how it can be helped. For now I’m just on some strong pain killers with my arm in a sling. I’m not supposed to use it for anything, but I am supposed to extend my elbow.

Us programmers have some terrible body problems. I’m off back to work for midday when my wife picks me. Hopefully the pain will be bearable at work.

Posted in Pages | 2 Comments

Outgrowing Responsibility

The one thing about both writing to your own specification, and writing object-oriented code is that things because obfuscated as it’s contained in your own mind – something of which that is free to do what it wills when you’re laying out your own plans. An untidy mind leads to untidy code, which is why staring at the screen for hours on end leads to crappy code, in my opinion. What I do wonder though is at what point does an object outgrow its responsibility? For example I’m writing some network code at the moment which has a connection object. This object has the ability to send and receive messages, but internally the functioning of the system is quite complex, but of course it need not be exposed.

When sending and receiving data there’s a a considerable amount to think about. Threading is important as queues are required when both sending and receiving data as – whilst processing plain text can be quite quick – there can be a chance that too much comes in at a single moment, perhaps caused by some network lag. So already we have two nestings within the connection object dealing with both the sending and receiving of data by pulling data off the queue, and pushing data down the network. So now we have two threads spinning on the network, two queues, at least the observer pattern, input and output streams.

The object is designed to send and receive data, which is how it’s handled externally, but can an object take on too much internal responsibility? I tend to dwell on that.

Posted in Pages | 1 Comment

Christmas Rocks

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.

Posted in Pages | 3 Comments

UNION ALL Versus Sub-Queried JOIN In MS SQL 2008

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.

Posted in Pages | 5 Comments

MooTools Non-Flickering Slide In/Out With Initial Closed State

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.

Posted in Pages | Leave a comment