Rosher Consulting

Software Consulting and Development Services

House Network Part 1

I’ve had a number of posts planned for a while on the new home network, as it’s been nearly 2 years since we moved house, it’s about time I got around to blogging about it!

Our old house had a home network but it was organic in nature, it started off with a wireless router and was then augmented with a mixture of cat5e and cat6 cables from the router to various rooms as needed. I also had a couple of small Netgear swtiches to help extend it even further, so basically it wasn’t very efficient but it got the job done.

I’d seen a few home network installs on various forums over the years (in particular this), so when we decided to move house, I started to plan what I wanted and as soon as we were settled in the new house I ordered everything I would need to get started with the install.

Toys!48 port patch panel and patch leads

Yes, that is 610m of Cat6 cable! :-)

The loft in the new house is quite big, so it seemed the perfect location for node zero, the only problem was how to run the cables from the loft to the rest of the house? After some debate with the other half we decided that running the cable through our bedroom and in to the garage below was the best option as that also enabled me to run the cables from the garage in to the cupboard under the stairs and then from there under the floorboards, eventually I would box in the cables running through our bedroom (2yrs later and this still isn’t done, whoops).

Lots of cable!Eeek!That's a bit better

Once I’d got to this point, I asked a friend to help me route them downstairs and under the floorboards to the various points in the lounge, it took us a whole day but me managed to get it all done and we’d just put the last floorboard back when the other half came home, phew!

In total the initial run included 11 cables, with 8 points going behind the TV, 2 at the far end of the room and 1 in the hallway by the telephone point.

Through the garageUnder the stairs and floorboardOut they pop

Finishing offFar end of the roomHallway

Initially I wasn’t planning on getting a server rack as I thought they were too expensive, however I found a seller on eBay that were selling them for a great price. In total I bought a 12U rack and 2 x 3U shelves for £103 and I have to say that the quality of the rack is excellent and the packaging was first class, can’t recommend highly enough.

The rack arrivesThe rack installed

End of Part 1 – in Part 2 we’ll expand the system with even more cable runs and I’ll explain what the various points are being used for.

jQuery : working with SELECT lists

I’ve recently had to do some work with SELECT lists using jQuery and found the documentation to be a little sparse, there’s a few good articles out there, such as this one, but I couldn’t find any that had everything I needed so I thought I would share my experiences and provide a few examples to help others, so here goes.

(Disclaimer: I’m not suggesting that any of these snippets are necessarily the best or the fastest way to do things but they get the job done, your mileage may vary!)

To handle changes and get the currently selected value:

$("#mySelect").change(function (event) {
    alert($(this).val());
}

Retrieving the text of the currently selected option:

$("#mySelect option:selected").text();

With the above you could also remove the option and just do:

$("#mySelect :selected").text();

however I’ve always thought that jQuery selectors should be as specific as possible for performance reasons, hence why I use the former, though I doubt in this case that it would make any difference.

Finding an option by its value:

var listitem = $("#mySelect option[value=" + valueToFind + "]");

Finding an option by its text value:

// The following should work but doesn't in all browsers:
var listitem = $("select option[text='" + textToFind + "']");
 
// Since the above doesn't work in all browsers we can manually search 
// through all list items on the page
var listitem = null;
$("select option").each(function() {
    if ($(this).text() === textToFind) {
        listitem = $(this);
    }
});

Retrieving all options:

var options = $("#mySelect option");

Removing all options:

$("#mySelect option").remove();

Removing the currently selected option:

$("#mySelect option:selected").remove();

Adding an option:

$("#mySelect").append("<option value=\"" + myValue + "\">" + myText + "</option>");

How many options are there:

var count = $("#mySelect option").length;

Hiding all selects on the page:

var selects = $("select:visible");
selects.hide();

You may wonder why I assigned a variable before hiding the selects, well you’ll also notice that I only selected visible elements because if you’re hiding them to show an overlay (which you would need to do in IE6) then you’ll only want to show the selects that were visible before you showed your overlay, hence why they’re stored in a variable.

That should cover most of what you’ll need to do with SELECTS, if you spot any mistakes or anything that could be improved then let me know in the comments.